SHIFT(1P)

πŸ’– PROLOG πŸ’–

ok so bestie, real talk first: 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. so like, check before you commit, yk? 🫢


✨ NAME ✨

shift β€” shift positional parameters πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

shift [n]

πŸ¦‹ DESCRIPTION πŸ¦‹

ok so here's the tea: the positional parameters shall be shifted. 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. literally everyone slides 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. no cap.

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. If n is 0, the positional and special parameters are not changed β€” like, nothing moves, the vibe stays exactly as it was πŸ™ˆ


πŸ’… OPTIONS πŸ’…

None. ✨ zero flags, zero drama.


🌸 OPERANDS 🌸

See the DESCRIPTION. (the n lives there, go look πŸ‘€)


⭐ STDIN ⭐

Not used. it's not reading anything from you bestie.


🌈 INPUT FILES 🌈

None.


🧚 ENVIRONMENT VARIABLES 🧚

None.


πŸ’œ ASYNCHRONOUS EVENTS πŸ’œ

Default.


πŸ“ STDOUT πŸ“

Not used. it's giving silent, it's giving mysterious.


😭 STDERR 😭

The standard error shall be used only for diagnostic messages. so if it starts yelling at you, that's why.


πŸŽ€ OUTPUT FILES πŸŽ€

None.


πŸ”₯ EXTENDED DESCRIPTION πŸ”₯

None.


πŸ‘‘ EXIT STATUS πŸ‘‘

ok this is the important part, 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; if the shell does not exit in this case, a non-zero exit status shall be returned. Otherwise, zero shall be returned. so yeah β€” bad n = possible rage quit πŸ’€


πŸ’– CONSEQUENCES OF ERRORS πŸ’–

Default.

The following sections are informative. (aka, the bonus lore ✨)


πŸ¦‹ APPLICATION USAGE πŸ¦‹

None.


✨ EXAMPLES ✨

ok this is the moment, the demonstration, the slay 🎬

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

like… a and b literally left the chat and c d e is the new main character energy πŸ‘‘


πŸ’… 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 🫢 this was brought to you by IEEE/The Open Group, dated 2017, filed under SHIFT(1P) β€” k bye, go shift some parameters, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from