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
07-05-2004 03:12 PM
07-05-2004 03:12 PM
shift
Guru,
Any idea what this shift is doing.
regards
mB
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2004 03:19 PM
07-05-2004 03:19 PM
SolutionTry 'man ksh' and search for shift '/shift':
Here is what I get:
% shift [n] The positional parameters from $n+1 ... are renamed
$1 ...; default n is 1. The parameter n can be any
arithmetic expression that evaluates to a non-negative
number less than or equal to $#.
So what was $2 now becomes $1
Seems usefull in a parameter processing loop.
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2004 03:21 PM
07-05-2004 03:21 PM
Re: SHIFT
http://unix.about.com/library/course/blshscript-l5b.htm
regds,
Abdul.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2004 03:28 PM
07-05-2004 03:28 PM
Re: SHIFT
moves the values stored in command line arguments to left one position
For ex,
assume
$1=mala $2 boy
alter executing the shift statement
$1=boy $2=
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2004 03:41 PM
07-05-2004 03:41 PM
Re: SHIFT
The shell man pages hae the answer, although TG's answer is a good example.
% shift [n]
Rename the positional parameters from n+1 ... to 1 .... The default value of n is 1. n can be any arithmetic expression that evaluates to a nonnegative number less than or equal to $#.
source: sh-posix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2004 01:12 AM
07-07-2004 01:12 AM
Re: SHIFT
create shift_it containing
#!/bin/ksh
#
echo $1
shift
echo $1
chmod 755 shift_it
shift_it hello world
verify the output
hello
world