Search:

Type: Posts; User: Mia_tech; Keyword(s):

Page 1 of 10 1 2 3 4

Search: Search took 0.09 seconds.

  1. Re: what is the best way to read numbers from stdin

    what's the point of the for loop... num is already an array
  2. is this the best way to check whether a file exist or not

    is this a good way to check whether a file exist or not? and then delete it



    echo -n "Enter file name: "
    read fileName
    for i in *
    do
    if [ -f $i ] && [ $i == $fileName ]; then
    rm...
  3. Re: what is the best way to read numbers from stdin

    Enter a list of numbers: 2 10 34 44 20

    then iterate through the numbers and add them to an array... doesn't have to be (while read) any other method is fine, but
    read -a numbers I'm looking for...
  4. Re: what is the best way to read numbers from stdin

    I tried this method too, after entering numbers I press enter and terminal is waiting for more input...
  5. Re: what is the best way to read numbers from stdin

    with this method, after you enter the numbers and press enter the terminal is still waiting for input.... something is missing
  6. what is the best way to read numbers from stdin

    what is the best way to read a line containing multiples numbers into an array.
    I know "read -a numbers" will put all numbers into the numbers array. But I want to read every number and put them...
  7. Replies
    5
    Views
    349

    [SOLVED] Re: calculator script

    I think the best way is to pass the arguments like: "10 \* 10", even though is a single param when you pass it to a functions you can still break it down into $1 $2 $3

    Thanks
  8. Replies
    5
    Views
    349

    [SOLVED] Re: calculator script

    yeah, I tried that (script.sh 10 \* 2) but I'm getting errors. Also if I use either "" or ' ' it will interpret the parameters as a single parameter right?
  9. Replies
    4
    Views
    2,063

    [SOLVED] Re: drawing a shape with shell script

    very efficient algorithm!..
    Thanks
  10. Replies
    5
    Views
    349

    [SOLVED] calculator script

    I have a simple script which takes three parameters in the form of

    ./script.sh 10 * 2

    and produces an output, the script works find; however, it doesn't work when using multiplication 10 * 2. I...
  11. Replies
    4
    Views
    2,063

    [SOLVED] Re: drawing a shape with shell script

    great job!.. would you mind explaining this two sentences


    row="${row%?}*"
    row="${row#?}**"
    I know it is a variable declaration, but what's on the right side of "=" sign I haven't seen it yet
  12. Replies
    4
    Views
    2,063

    [SOLVED] drawing a shape with shell script

    I'm trying to draw a tree in the following form


    *
    ***
    *****
    *******
    *********

    as you can see I need both spaces, and "*" stars in every line, but I can't get it quite the...
  13. Replies
    6
    Views
    765

    [SOLVED] Re: how to sort a word file by word size

    how about if I only wanted to display the words and not the size?
  14. Replies
    1
    Views
    425

    sorting a word file based on word length

    guys, I have a text file with words, and I want to put them into an array and sort them based on string length/size of every word. I wonder if there's a command that would allow me to do this, so I...
  15. Replies
    6
    Views
    765

    [SOLVED] Re: how to sort a word file by word size

    no I have to do it from a command line/script. I just was looking for a command, so I wouldn't have to write an algorithm to do it

    thanks
  16. Replies
    6
    Views
    765

    [SOLVED] how to sort a word file by word size

    I have a text file with words, and I would like to sort it by word length/size. I checked the sort commands for any option that would allow me to do this, but none seem to work.

    thanks
  17. Replies
    1
    Views
    225

    [SOLVED] why am I getting unexpected EOF

    I'm getting unexpected eof, but I don't see the error

    #!/bin/bash
    #passing and returning arrays from functions

    #calculating total sum
    times_two() {
    local oarray=($(echo $@))
    local...
  18. Re: why am I getting error when trying to multiply by 2

    yeah, the index in my array was wrong!... I changed it to this and worked

    times_two() {
    local oarray=($(echo $@))
    local newarray=($(echo $@))
    i=0
    while [ $i -lt $# ]
    do...
  19. Replies
    0
    Views
    1,615

    unable to start or stop motion with script

    I have the following script that pretty much check for the status of motion daemon and based on that it stop it or start the daemon, I have added the command along with my username to sudoers file so...
  20. why am I getting error when trying to multiply by 2

    I'm getting errors when trying to multiply by 2.


    #!/bin/bash
    #passing and returning arrays from functions

    #calculating total sum
    times_two() {
    local oarray=(`echo $@`)
    local...
  21. Replies
    1
    Views
    5,643

    [SOLVED] getting: too many arguments error

    I have the following script and I'm getting: too many arguments error


    #!/bin/bash

    #creating new dir and copy files into it
    create_dir() {
    if [ $# -eq 0 ]; then
    echo "Usage: $0 param1...
  22. Replies
    1
    Views
    353

    method not working in java

    guys, the toArray method is not working, could someone tell me why
    Thanks


    package com.javablackbelt.utils;

    import java.util.ArrayList;
    import java.util.Arrays;
    import...
  23. [xubuntu] Re: unable to login in terminal tty1, tty2, etc...

    nope, but the whole file is commented out...
  24. [xubuntu] Re: unable to login in terminal tty1, tty2, etc...

    I've tried different tty1...6 with same results
  25. [xubuntu] Re: unable to login in terminal tty1, tty2, etc...

    yeah, I'm getting authentication failure in the logs... but I'm able to login to my X session, and sudo password works too


    Oct 22 18:36:08 computer1 login[1216]: pam_unix(login:auth):...
Results 1 to 25 of 250
Page 1 of 10 1 2 3 4