Re: [SLUG] bash shell script question

From: Jan Mason (td376@mail.anonymizer.com)
Date: Sun Sep 15 2002 - 15:11:42 EDT


I ran into this problem writing some backup scripts using tar. When I
run into problems I extract the problem and put it in a seperate file
for testing. I was looking for a way to get the system to expand ~ into
$HOME. Since that is not possible it has to be done manually in the
script. Thanks to all for the education and fix.

Ronan Heffernan wrote:

> BASH 'expands' the ~ to the value of $HOME whenever it is passed-in to
> any program as a command-line arg. This is not going to happen for
> interactive user input. You might be able to use 'expr' to perform the
> expansion:
> read directory
> fi
> echo "dir = " `expr $directory`
>
> Something like that should work.
>
> You aren't trying to get this script to change your pwd are you? Unless
> you 'source' that script every time, you will be changing the pwd of the
> shell that was launched just for the purpose of executing the script.
> Once the script exits, and the short-lived shell terminates, the pwd of
> your original shell should be unchanged.
>
> --ronan
>
>
>
>
>

-- 
Jan Mason
td376@mail.anonymizer.com



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:36:41 EDT