#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    3
    Rep Power
    0

    How 2 Redirect Outputs 2 a VARIABLE?


    Hi!!
    Alot of sites tells you how to redirect output of an command to a file but can anyone tell me how to redirect outputs to a shell variable?
    eg. How can I store the result of "echo *" to a variable call "a".

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    in bash you use backticks `` or $():
    Code:
    $DATE=`date +%Y-%m-%d`
    echo "Today is: $DATE"
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    3
    Rep Power
    0

    Smile


    Much appreciated

IMN logo majestic logo threadwatch logo seochat tools logo