- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Shift command! Please help
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
Discussions
Discussions
Discussions
Forums
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
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
тАО01-21-2008 07:52 PM
тАО01-21-2008 07:52 PM
Shift command! Please help
I am facing problem with the shift command.
I have 3 shell scripts:
1.Master.ksh
2.Intermediate.ksh
3.Final.ksh
The Master.ksh is calling Intermediate.ksh first and then calling Final.ksh.
In intermediate.ksh, at the end shift command is used.
Final.ksh is expecting a parameter to be passed to it.
Now because of this shift command, the Final.ksh is not recognising the parameter passed to it.
I cannot change intermediate.ksh script, and Final.ksh has to take a parameter.
Please help me how I can resolve this issue.
- Tags:
- shift
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-21-2008 08:52 PM
тАО01-21-2008 08:52 PM
Re: Shift command! Please help
Plan B. Whatever the last argument is that you send to Master.ksh (or whatever the last argument that Master.ksh uses when intermediate.ksh is called) should be captured in a variable and sent to intermediate.ksh twice. That way, the shift will remove one but not the final argument.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2008 12:11 AM - edited тАО09-27-2011 01:41 PM
тАО01-22-2008 12:11 AM - edited тАО09-27-2011 01:41 PM
Re: shift command!
>The Master.ksh is calling Intermediate.ksh first and then calling Final.ksh.
Master calls intermediate and then master calls final? Or intermediate calls final?
>In intermediate.ksh, at the end shift command is used.
A shift in intermediate.ksh can't change the parms in Master.ksh, my first assumption.
>I cannot change intermediate.ksh script, and Final.ksh has to take a parameter.
It would help if we had an example of Master.ksh and how the parms are moved around.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2008 04:51 AM
тАО01-22-2008 04:51 AM
Re: Shift command! Please help
( . ./Intermediate.ksh )
then something like:
SAVARGS="$*"
. ./Intermediate.ksh
set -- "$SAVARGS"
. ./Final.ksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2008 10:39 AM
тАО01-22-2008 10:39 AM
Re: Shift command! Please help
Master a b c
do
Master a b c c
Maybe you are calling the Master script incorrectly?
HtH,
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2008 10:54 AM
тАО01-22-2008 10:54 AM
Re: Shift command! Please help
a correction:
Master calls intermediate, intermediate shifts and exits, master continues and call final.
The shift in intermediate only affects the argument list passed on to intermedaiate and has no influence on calling the final script.
I just tested this in ksh on Linux.
So your problem is not caused by the intermediate script.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2008 11:41 AM
тАО01-22-2008 11:41 AM
Re: Shift command! Please help
you're going to have to modify the master to save the original arg list, and then call the "final" script w/ the saved args
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-22-2008 10:31 PM - edited тАО09-27-2011 01:42 PM
тАО01-22-2008 10:31 PM - edited тАО09-27-2011 01:42 PM
Re: shift command!
>Laurent: then something like: SAVEARGS="$*"
The proper way to save args is:
set -A SAVEARGS -- "$@"
The proper way to reset them is:
set -- "${SAVEARGS[@]}"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-23-2008 01:06 AM
тАО01-23-2008 01:06 AM
Re: Shift command! Please help
SAV="$*"
set -- $SAV
for instance "A B" "C D"
with my method will become
A B C D ( 4 parameters)
and
set -- "$SAV"
will become
"A B C D" (1 parameter)