SHIFT(1POSIX)

๐Ÿฆ‹ SHIFT(1POSIX) โ€” the POSIX Programmer's Manual, bestie edition ๐Ÿ’…

okay so real talk: this page lives in the POSIX Programmer's Manual, and the Linux version of this interface might be a whole different girl ๐Ÿ’€ โ€” like, the Linux implementation may differ (so go check the corresponding Linux manual page for the tea on Linux behavior), or honestly the interface may not be implemented on Linux at all. so don't come for me if it's not there.


๐ŸŒธ PROLOG ๐ŸŒธ

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.


โœจ NAME โœจ

shift โ€” shift positional parameters ๐Ÿ’ซ


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

shift [n]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

okay bestie, here's the vibe: the positional parameters shall be shifted. so positional parameter 1 shall be assigned the value of parameter (1+n), parameter 2 shall be assigned the value of parameter (2+n), and so on, and so on, it just keeps sliding down the line. โœจ

the parameters represented by the numbers "$#" down to "$#-n+1" shall be unset, and the parameter '#' is updated to reflect the new number of positional parameters. so the count gets a lil glow-up too ๐Ÿ’…

now, the value n shall be an unsigned decimal integer less than or equal to the value of the special parameter '#'. if n is not given, it shall be assumed to be 1. and if n is 0, the positional and special parameters are not changed โ€” like, nothing moves, we're just standing here, iconic behavior honestly ๐Ÿงโ™€๏ธ


๐Ÿ‘‘ OPTIONS ๐Ÿ‘‘

None. that's it. no flags, no frills, no notes. ๐Ÿซถ


๐Ÿ“ OPERANDS ๐Ÿ“

See the DESCRIPTION. (the n situation lives up there, go look ๐Ÿ‘€)


๐ŸŒˆ STDIN ๐ŸŒˆ

Not used. she does not read from stdin, she's above that. ๐Ÿ™ˆ


๐Ÿงš INPUT FILES ๐Ÿงš

None.


๐Ÿ’œ ENVIRONMENT VARIABLES ๐Ÿ’œ

None.


โญ ASYNCHRONOUS EVENTS โญ

Default.


๐Ÿฆ‹ STDOUT ๐Ÿฆ‹

Not used. no output, she's silent, she's mysterious. ๐Ÿ˜Œ


๐Ÿ’€ STDERR ๐Ÿ’€

The standard error shall be used only for diagnostic messages. that's the only time she speaks up, and it's to tell you something's wrong.


๐ŸŒธ OUTPUT FILES ๐ŸŒธ

None.


๐ŸŽ€ EXTENDED DESCRIPTION ๐ŸŽ€

None.


๐Ÿ”ฅ EXIT STATUS ๐Ÿ”ฅ

okay this part matters, listen up:

if the n operand is invalid or is greater than "$#", this may be considered a syntax error and a non-interactive shell may exit ๐Ÿ˜ญ โ€” like, straight up leaving the party. if the shell does not exit in this case, a non-zero exit status shall be returned. otherwise, zero shall be returned. slay. โœจ


๐ŸŒˆ CONSEQUENCES OF ERRORS ๐ŸŒˆ

Default.

The following sections are informative.


๐Ÿ’… APPLICATION USAGE ๐Ÿ’…

None.


โœจ EXAMPLES โœจ

look at her go, no cap:

$ set a b c d e
$ shift 2
$ echo $*
c d e

ate. left absolutely no crumbs. ๐Ÿ‘‘


๐Ÿง  RATIONALE ๐Ÿง 

None.


๐Ÿ”ฎ FUTURE DIRECTIONS ๐Ÿ”ฎ

None.


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

Section 2.14, Special Built-In Utilities


Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page bestie, mwah ๐Ÿ’‹

big love and eternal credit to IEEE / The Open Group, 2017 for this one โ€” SHIFT(1POSIX) forever in our hearts ๐Ÿซถโœจ๐Ÿ’–

๐Ÿ“ฆ where this page comes from