Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, When lauching this command line: expect -d -c 'spawn ssh -l $login $IP;expect "Password:";send $password\n";expect "(Machine $machine.domain)> ";send "$cmd\n";expect "[1]> ";send "\n";expect "(Machine $machine.domain)> ";send "exit\n";expect eof' result format ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2013
    Posts
    2

    Return format different between contab & command line


    Hi,

    When lauching this command line:
    expect -d -c 'spawn ssh -l $login $IP;expect "Password:";send $password\n";expect "(Machine $machine.domain)> ";send "$cmd\n";expect "[1]> ";send "\n";expect "(Machine $machine.domain)> ";send "exit\n";expect eof'

    result format is different:
    Command line:
    1 vaaaaaaaaaaaaaaaaaal1 champs1 champs2 champs3 champs4 champ5
    2 val2 champs1 champs2 champs3 champs4 champ5
    3 -val3 champs1 champs2 champs3 champs4 champ5
    4 val4 champs1 champs2 champs3 champs4 champ5
    5- val5 champs1 champs2 champs3 champs4 champ5
    ....
    8- vaaaaaaaaaal8 champs1 champs2 champs3 champs4 champ5
    ........
    12- vaaaaaaaaaaaaaaaaal5 champs1 champs2 champs3 champs4 champ5

    20 val20 champs1 champs2 champs3 champs4 champ5

    crontab:
    1 vaaaaaaaaaaaaaaaaaal1 champs1 champs2 champs3 champs4 champ5
    2 val2 champs1 champs2 champs3 champs4 champ5
    3 -val3 champs1 champs2 champs3 champs4 champ5
    4 val4 champs1 champs2 champs3 champs4 champ5
    5- val5 champs1 champs2 champs3 champs4 champ5
    ....
    8- vaaaaaaaaaal8 champs1 champs2 champs3 champs4 champ5
    ........
    12- vaaaaaaaaaaaaaaaaal5 champs1 champs2 champs3 champs4 champ5

    20 val20 champs1 champs2 champs3 champs4 champ5

    ==> I realy don't understand: i tried to manipulate $COLUMNS et cols, nothing happened....


    An explanation woulg be great!!
    thanks
    Regards
    kondor76

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Hello and welcome!

    Okay, after a minute of straining my eyes, I give up. What is the difference? Is it a formatting thing, that is getting squashed when you post to the thread? Try wrapping the pasted text in CODE tags (the icon with the pound sign in the toolbar) to keep the formatting.

  3. #3
    Just Joined!
    Join Date
    Mar 2013
    Posts
    2
    Sorry for the mistake, i posted wrond terms.

    Here is the correct post:

    Hi,

    When lauching this command line:
    Code:
    expect -d -c 'spawn ssh -l $login $IP;expect "Password:";send $password\n";expect "(Machine $machine.domain)> ";send "$cmd\n";expect "[1]> ";send "\n";expect "(Machine $machine.domain)> ";send "exit\n";expect eof'
    result format is different:
    Command line:
    Code:
    1 vaaaaaaaaaaaaaaaaaal1 champs1 champs2 champs3 champs4 champ5
    2 val2 champs1 champs2 champs3 champs4 champ5
    3 -val3 champs1 champs2 champs3 champs4 champ5
    4 val4 champs1 champs2 champs3 champs4 champ5
    5- val5 champs1 champs2 champs3 champs4 champ5
    ....
    8- vaaaaaaaaaal8 champs1 champs2 champs3 champs4 champ5
    ........
    12- vaaaaaaaaaaaaaaaaal5 champs1 champs2 champs3 champs4 champ5
    
    20 val20 champs1 champs2 champs3 champs4 champ5
    crontab:
    Code:
    1 vaaaaaaaaaaaaaaaaaal1	champs1	champs2	champs3	champs4
    champ5
    2 val2	champs1	champs2	champs3	champs4	champs5
    3- val3	champs1	champs2	champs3	champs4	champs5
    4 val4	champs1	champs2	champs3	champs4	champ5
    5- val5	champs1	champs2	champs3	champs4	champ5
    .....
    8- vaaaaaaaaaal8	champs1	champs2	champs3	champs4
    champ5
    ......
    12- vaaaaaaaaaaaaaaaaal5	champs1	champs2	champs3	champs4
    champ5
     
    ....
    20-val20 champs1	champs2	champs3	champs4	champ5
    ==> I realy don't understand: i tried to manipulate $COLUMNS et cols, nothing happened....


    An explanation woulg be great!!
    thanks
    Regards
    kondor76 .
    Last edited by atreyu; 03-21-2013 at 12:57 AM. Reason: added CODE tags

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    I can't emulate your problem. Can you show exactly what your $cmd is doing?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •