- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- removing command line parameters to shell a script
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
09-07-2005 02:56 AM
09-07-2005 02:56 AM
I have two shell scripts, say 'a' and 'b'.
Contents are as given below:
# file 'a'
echo "in a: $*"
. b
----------------------
# file 'b'
echo "in b: $*"
----------------------
When I invoke 'a' with some command line parameters, those are seen by 'b' also (sourcing effect); but I do not want 'b' to be aware of the command line parameters to 'a'.
Since 'b' sets environment variables for 'a', I have to source it as given above.
Also note that I cannot edit script 'b'.
Any ideas how to unset those command line parameters?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2005 03:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2005 03:07 AM
09-07-2005 03:07 AM
Re: removing command line parameters to shell a script
That works!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2005 03:11 AM
09-07-2005 03:11 AM
Re: removing command line parameters to shell a script
what you can do is:
set ""
. b
The set "" will clear all positional variables.
If you still need access to these variables in "a" after "b" has been invoked then you can save thenm in a temporary variable (which will be visible to "b" since it's the same process but presumably "b" will have no knowledge of your data hiding).
XX=${@}
set "" # positional variables are cleared
. b
set ${XX} # positional variables are now restored
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2005 03:13 AM
09-07-2005 03:13 AM
Re: removing command line parameters to shell a script
. b ""
This will set the command parameters to empty.
Or you could use "shift $#" in a.
HTH
-- Rod Hills