1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2011
    Rep Power

    Add variable to shortened path

    I'm not quite sure how to explain this, but basically I want to take the path (not the entire path, but an abbreviated path) of the current directory and add the argument passed onto the script to that path.

    This is the code I'm using

    cd $1
    "/$(pwd | sed 's/\// /g')"
    When I run my script with 'BTP100' as $1, I only get:
    / home drey5

    I should point out that drey5 is the directory where I run my script from, so I don't think that I'm switching to the directory I specified as my argument.

    I'd want my output to look something along the lines of:
    / home drey5 BTP100
  2. #2
  3. Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2006
    Rep Power
    It works for me ... IF I put an echo before the output string.
    What shell are you using and what happens if you run those two command by hand from the command line?
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo