Results 1 to 2 of 2
I am new to this forum and new to scripting so please bare with me, thanks.
Question: How do you have a user input a directory path and check to ...
- 12-31-2008 #1Just Joined!
- Join Date
- Dec 2008
- Posts
- 1
Need help with user input
I am new to this forum and new to scripting so please bare with me, thanks.
Question: How do you have a user input a directory path and check to see if that path exist??
I need to have the user to input a directory path and then have my code check to see if the directory exist. If it exist then change to that directory and proceed with the rest of the code. If directory does not exist proceed within the current directory.
example:
echo "Please input the directory where the files are located"
Thanks for all help in advanced.
I am using bash on an apple powerbook g4.
- 01-01-2009 #2
Out of curiosity, is this a homework assignment? Homework questions are not allowed on this forum.
The best Bash guide that I have ever used is:
Advanced Bash-Scripting Guide
In particular, I will point you towards these sections:
File test operators
Internal Commands and Builtins (see the "read" command)
Good luck!DISTRO=Arch
Registered Linux User #388732


Reply With Quote