- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Exiting a script within a script
Operating System - Linux
1753798
Members
8029
Online
108805
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО06-16-2006 09:13 AM
тАО06-16-2006 09:13 AM
Hey gang,
I am wanting to execute a 'su - user -c "scriptA"' inside a script (say scriptB). However, scriptA requires an interrupt (like a return) to exit. Is there a way to pass variables to scriptA through scriptB while still switching users? Thanks for the help.
I am wanting to execute a 'su - user -c "scriptA"' inside a script (say scriptB). However, scriptA requires an interrupt (like a return) to exit. Is there a way to pass variables to scriptA through scriptB while still switching users? Thanks for the help.
Solved! Go to Solution.
- Tags:
- su
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-16-2006 09:48 AM
тАО06-16-2006 09:48 AM
Solution
Hi:
See if this helps:
# cat /tmp/scriptA
#!/usr/bin/sh
echo "...in A..."
su juiceman -c "/tmp/scriptB $@ < /dev/null"
echo "...in A..."
exit 0
# cat /tmp/scriptB
#!/usr/bin/sh
echo "B sees $@"
echo "reading input"
read
echo "exiting B..."
exit 0
...Run as:
# /tmp/scriptA hello!
...in A...
B sees hello!
reading input
exiting B...
...in A...
Regards!
...JRF...
See if this helps:
# cat /tmp/scriptA
#!/usr/bin/sh
echo "...in A..."
su juiceman -c "/tmp/scriptB $@ < /dev/null"
echo "...in A..."
exit 0
# cat /tmp/scriptB
#!/usr/bin/sh
echo "B sees $@"
echo "reading input"
read
echo "exiting B..."
exit 0
...Run as:
# /tmp/scriptA hello!
...in A...
B sees hello!
reading input
exiting B...
...in A...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2006 02:11 AM
тАО06-18-2006 02:11 AM
Re: Exiting a script within a script
Hi,
If you don't want to press enter by yoursef,
you can use the following:
SCRIPT_WHICH_NEEDS_ENTER <<$LABEL
$LABEL
or
echo "\n"| SCRIPT_WHICH_NEEDS_ENTER
HTH
If you don't want to press enter by yoursef,
you can use the following:
SCRIPT_WHICH_NEEDS_ENTER <<$LABEL
$LABEL
or
echo "\n"| SCRIPT_WHICH_NEEDS_ENTER
HTH
Entities are not to be multiplied beyond necessity - RTFM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-05-2006 02:56 PM
тАО10-05-2006 02:56 PM
Re: Exiting a script within a script
thanks
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP