![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| trouble using read to store values in variables from command output | ProGrammar | UNIX for Dummies Questions & Answers | 2 | 01-09-2009 11:09 AM |
| environment variables | sumsin | High Level Programming | 6 | 03-13-2006 11:17 AM |
| help..Environment variables... | sekar sundaram | UNIX for Dummies Questions & Answers | 3 | 08-30-2005 04:35 AM |
| environment variables | Esaia | High Level Programming | 2 | 02-20-2003 08:19 PM |
| what is the use of Environment variables | indianguru | UNIX for Dummies Questions & Answers | 2 | 07-24-2001 10:41 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Interpreting Logicals/Environment Variables using the read command
Hi All I have something that from the outset seems really trivial but in practice is not quite working. I have the following code sample in my shell script which illustrates the problem Code:
echo "enter home directory" read home mkdir $home/newdir The user then enters a logical $HOME in the prompt. This is what is displayed on the screen Code:
enter home directory $HOME mkdir: cannot create directory `$HOME/newdir': No such file or directory If I type the full name into the prompt, it works fine. But this isn't ideal as in the real script, the directory structure could be 10 directories deep. Typing the full path could lead to potential issues. Is there some way for the read command to interpret environment variables? Thanks |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|