What is wrong with this basic shell script?
Hello LinuxQuestions world!
I'm still pretty new to linux, and burning through a unix/linux course offered at the local JC. I'm working on an assignment for shell scripting and I need to make a script that displays a bunch of junk (pwd, date, yadda yadda) and then prompts the user to enter a directory so they can view the contents. If it's valid, then it displays the contents. If it isn't then it throws an error message and the script stops. This is done using if, then and else. The problem is, my script always shoots straight to the else, even if the subdir entered IS a valid subdirectory. Here's what I have: Code:
clear Code:
./Assigment-3 Code:
/home/cs41s1003/Assignment-3 Also, cs41s1003 is my "home" folder for the class on our linux server, which is a subdir of home. (home/cs41s1003/Assignment#/yadda/yadda) Thanks! Tristan |
Please post the output of the script. It's easier to read if you put it in code tags (that's a link to instructions or you may prefer to use "Advanced Edit" mode which has a # button for code tags).
|
Quote:
;) |
Also, your test is against the current directory structure so:
Quote:
So unless you have: Quote:
|
All times are GMT -5. The time now is 04:41 PM. |