Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    232

    Unanswered: first shell script

    I was writing my first script on vi editor

    #!/bin/sh
    echo hello
    echo i am; 'whoami' ----without ';' it give out i am whoami so i put ;
    me='whoami'
    iam="i am $me"
    echo $iam


    when i run it
    hello
    i am
    user
    i am whoami---- i want this as ' i am user'

    can anybody help !!!


    thanks
    bigfoots

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    Code:
    #!/bin/sh
    echo hello
    echo "i am `whoami`"
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  3. #3
    Join Date
    Oct 2003
    Posts
    232
    echo "i am `whoami`"

    does not work

    " will make it as one work my main problem as i see it is 'whoami' is a new command

    i should say
    echo i am 'whoami'
    bigfoots

  4. #4
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    be sure to use back-quotes arounf whoami - NOT single quotes:
    `whoami`
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  5. #5
    Join Date
    Oct 2003
    Posts
    232
    yes i was using single quotes

    thanks
    bigfoots

Posting Permissions

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