Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Bash script - cd to unknown directory

    Hi All,

    I have a series of scripts I am using to turn CD's into FLAC files.

    The first one gets the album name and track names from the internet and then rips the CD to WAV using cdparanoia.

    I have another script that will convert the WAV files into flac files using my cluster.

    The problem I have is that I need to 'cd' to the folder containing the WAV files but the name is different each time as it is based on the album name.

    I have tried piping ls and cd etc but am getting nowhere!!!

    What I would like is a script that does the following.

    changes to (for exampe) /home/chris/flactemp/albumname

    I can then run the encoding script and them move the folder in to a completed area.

    Any help would be appreciated.



  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    Well, you could do something like this:
    cd ~/my_cds/$discname
    So basically, store the CD name in a variable, and just build the variable right into your cd command.

  3. #3
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    You may find the dirname command useful. It will pull the leading path from a variable that contains the filename.

  4. $spacer_open

Posting Permissions

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