- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: sh/bash question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2004 02:40 AM
02-02-2004 02:40 AM
when I'm in sh/bash and I execute variable that do not exists, I don't get any message. Nothing happens:
srv1> $blablabla
srv1> echo $?
0
srv1>
Well, I believe that it's ok, but I would like it to tell me that variable was not set and do not exist (like in csh and tcsh).
Is it possible?
Thanx
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2004 02:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2004 02:46 AM
02-02-2004 02:46 AM
Re: sh/bash question
# $VAR
sh: VAR: Parameter not set.
# echo $VAR
sh: VAR: Parameter not set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2004 04:06 AM
02-02-2004 04:06 AM
Re: sh/bash question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2004 04:44 AM
02-02-2004 04:44 AM
Re: sh/bash question
I've taken A. Clay Stephenson's caljd.sh scripts, changed the shell and gotten completely consistent results.
filevar=steve.file
export filevar
while read -r aa
do
echo $aa
done < $filevar
Will work in all three shells.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2004 05:20 AM
02-02-2004 05:20 AM
Re: sh/bash question
I think (as stated already by someone else)
'set -u' does the trick.
It means: treats unset variables as an error.
Apparently in your shell this has not been executed, so if you type $blablabla as a command, nothing gets executed. Apparently Todd 's shell has been told to treat unset variables as an error.
In addition I would suggest to add 'set -u' to your own shell scripts. It makes debugging easier (misspelled variables are detected immediately) and may prevent you from erasing a wrong directory.
I could not test Jan's solution...
Greetings,
JP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2004 06:29 AM
02-02-2004 06:29 AM
Re: sh/bash question
Best regards