- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- bash script problem
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
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
03-18-2004 01:20 AM
03-18-2004 01:20 AM
bash script problem
I've got a problem with a script:
#!/usr/bin/sh
cat << EOF | /usr/bin/su - oracle
DATABASE1
/opt/omni/lbin/open_database
EOF
I get:
-bash: line 1: DATABASE1: command not found
/opt/omni/lbin/open_database: line 1: svrmgrl: command not found
Oracle's shell is bash. On another server, where oracle's shell is tcsh, the same script works just fine.
What is the reason? Any ideas?
Marcin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2004 01:27 AM
03-18-2004 01:27 AM
Re: bash script problem
-Karthik S S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2004 01:31 AM
03-18-2004 01:31 AM
Re: bash script problem
Also though, it looks to me like you are doing, in effect, su - oracle DATABASE1". If there is no command called DATABASE1 then I would expect to tget the error you are. What and where is DATABASE1. Having said this, I still think, if it works in another shell that the "bash" behaviour I mention above is still the most likely culprit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2004 01:20 AM
03-19-2004 01:20 AM
Re: bash script problem
When I login as oracle I have to choose database name, which is in this case "DATABASE1". I don't know why bash behaves differently than tcsh. When I changed oracle's shell to tcsh it works OK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2004 01:41 AM
03-19-2004 01:41 AM
Re: bash script problem
I have tested this myself now and get the same result as you and it looks to be in a "read" in the .profile.
One way around this would be to change the .profile so that it only asked for which database if $DATABASE is not already defined. Then change your script to something like
/usr/bin/su - oracle -c 'DATABASE=DATABASE1 /opt/omni/lbin/open_database'
Though you might need to do "export DATABASE=DATABASE1" these days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2004 01:50 AM
03-19-2004 01:50 AM
Re: bash script problem
If you do it like that in the .profile then users can do this at the login prompt
login: user1 DATABASE=DATABASE6
Password:
This will set the variable when they log in. This feture of log in is often forgotten but is oh so useful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2004 02:43 AM
03-19-2004 02:43 AM
Re: bash script problem
Bill Hassell, sysadmin