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 π«Ά
β COPYRIGHT β
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
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms