Results 1 to 7 of 7

Thread: how can I echo output of ls in a bash script

  1. #1
    Join Date
    Apr 2006
    Location
    Provo, UT
    Beans
    527

    how can I echo output of ls in a bash script

    I've written a bash script that will do a backup, but it's written to deploy on many computers

    how can i echo the output of "ls /Volumes/" so that I can print it before I ask for the volume name
    thanks
    Last edited by syxbit; July 17th, 2007 at 12:38 AM.
    Thinkpad T400 | 14.1" LED Screen | Core 2 Duo T9400 | 3GB DDR3 | 320GB WD HD | intel 5300 | ATI 3470 & Intel 4500 GFX
    i7 920 | ASUS P6T DLX | 6GB DDR3 | Nvidia GTX 260 (216)

  2. #2
    Join Date
    Feb 2007
    Beans
    2,729

    Re: how can I echo output of ls in a bash script

    I don't understand - ls already echo's its output to the screen.

    What aren't you telling us ?

    MrC

  3. #3
    Join Date
    Jul 2007
    Location
    Idaho
    Beans
    23
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: how can I echo output of ls in a bash script

    Is this what you are looking for?
    Code:
    #!/bin/bash
    ls /Volumes/
    echo -n "Choose a volume: "
    read volume
    echo $volume

  4. #4
    Join Date
    Dec 2005
    Beans
    352
    Distro
    Gutsy Gibbon Testing

    Re: how can I echo output of ls in a bash script

    Quote Originally Posted by syxbit View Post
    I've written a bash script that will do a backup, but it's written to deploy on many computers

    how can i echo the output of "ls /Volumes/" so that I can print it before I ask for the volume name
    thanks
    Idk, this is a kinda round-about-way of doing this, but ill give it a shot.

    Code:
    #!/bin/bash
    volumes='ls /Volumes/
    echo $volumes

  5. #5
    Join Date
    Sep 2006
    Beans
    2,914

    Re: how can I echo output of ls in a bash script

    Quote Originally Posted by Motoxrdude View Post
    Idk, this is a kinda round-about-way of doing this, but ill give it a shot.

    Code:
    #!/bin/bash
    volumes='ls /Volumes/
    echo $volumes
    huh?

  6. #6
    Join Date
    Apr 2006
    Location
    Provo, UT
    Beans
    527

    Re: how can I echo output of ls in a bash script

    yea, sorry I wasn't clear
    your comments all helped too
    thanks
    Thinkpad T400 | 14.1" LED Screen | Core 2 Duo T9400 | 3GB DDR3 | 320GB WD HD | intel 5300 | ATI 3470 & Intel 4500 GFX
    i7 920 | ASUS P6T DLX | 6GB DDR3 | Nvidia GTX 260 (216)

  7. #7
    Join Date
    Dec 2005
    Beans
    352
    Distro
    Gutsy Gibbon Testing

    Re: how can I echo output of ls in a bash script

    Quote Originally Posted by ghostdog74 View Post
    huh?
    It sets volume as the output of 'ls volume' then echos it.

Bookmarks

Posting Permissions

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