A bash script that I'm trying to understand
Okay
|
He's trying to ensure var $fn actually has a non-empty value.
I recommend running it with debugging options thus Code:
set -xv # this makes the parser show you exactly what its doing as it goes |
|
why not use the -z test?
Example: Code:
#!/bin/sh Result: ~/Documents/Scripting $ ./test_string.sh Test 1 String value is : This has been a test This has been a test Test 2 : Test String is empty Test String is empty. ~/Documents/Scripting $ i just acquired a copy of Shell Scripting (Jason Cannon) (Amazon) which to me is very helpful. Lots of examples! |
@orri23, welcome to LQ.
Please do not edit your posts and remove content, especially the question or problem description. This thread is now ineffective because it makes no sense. Consider revising the original question to allow the thread to possibly be helpful to future solution seekers. Please do not repeat this behavior in the future, it doesn't help the site, it doesn't help all to increase their Linux knowledge, which is mainly why we are all here. Best Regards, - RT |
Why not use -n test?
(code example taken from @mike acker, then fixed and modified to match test prams) Code:
#!/bin/sh Code:
userx%slackwhere ⚡ ~ ⚡> testS="hite" |
All times are GMT -5. The time now is 08:55 AM. |