Skip to main content
added 198 characters in body
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

For positional parameters starting from the 5th one:

  • zsh or yash.

      myCommand "${@[5,-1]}"
    

(note, as always, that the quotes above are important, or otherwise each element would be subject to split+glob in yash, or the empty elements removed in zsh).

  • ksh93, bash or zsh:

      myCommand "${@:5}"
    

(again, quotes important)

  • Bourne-like shells (includes all of the above shells)

      (shift 4; myCommand "$@")
    

(using a subshell so the shift only happens there).

  • csh-like shells:

      (shift 4; myCommand $argv:q)
    

(subshell)

  • fish:

      myCommand $argv[5..-1]
    
  • rc:

      @{shift 4; myCommand $*}
    

(subshell)

  • rc/es:

      myCommand $*(`{seq 5 $#*})
    
  • es:

      myCommand $*(5 ...)
    

For positional parameters starting from the 5th one:

  • zsh or yash.

      myCommand "${@[5,-1]}"
    
  • ksh93, bash or zsh:

      myCommand "${@:5}"
    
  • Bourne-like shells (includes all of the above shells)

      (shift 4; myCommand "$@")
    

(using a subshell so the shift only happens there).

  • csh-like shells:

      (shift 4; myCommand $argv:q)
    

(subshell)

  • fish:

      myCommand $argv[5..-1]
    
  • rc:

      @{shift 4; myCommand $*}
    

(subshell)

  • rc/es:

      myCommand $*(`{seq 5 $#*})
    
  • es:

      myCommand $*(5 ...)
    

For positional parameters starting from the 5th one:

  • zsh or yash.

      myCommand "${@[5,-1]}"
    

(note, as always, that the quotes above are important, or otherwise each element would be subject to split+glob in yash, or the empty elements removed in zsh).

  • ksh93, bash or zsh:

      myCommand "${@:5}"
    

(again, quotes important)

  • Bourne-like shells (includes all of the above shells)

      (shift 4; myCommand "$@")
    

(using a subshell so the shift only happens there).

  • csh-like shells:

      (shift 4; myCommand $argv:q)
    

(subshell)

  • fish:

      myCommand $argv[5..-1]
    
  • rc:

      @{shift 4; myCommand $*}
    

(subshell)

  • rc/es:

      myCommand $*(`{seq 5 $#*})
    
  • es:

      myCommand $*(5 ...)
    
added 125 characters in body
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

For positional parameters starting from the 5th one:

  • zsh or yash.

      myCommand "${@[5,-1]}"
    
  • ksh93, bash or zsh:

      myCommand "${@:5}"
    
  • Bourne-like shells (includes all of the above shells)

      (shift 4; myCommand "$@")
    

(using a subshell so the shift only happens there).

  • csh-like shells:

      (shift 4; myCommand $argv:q)
    

(subshell)

  • fish:

      myCommand $argv[5..-1]
    
  • rc:

      @{shift 4; myCommand $*}
    

(subshell)

  • rc/es:

      myCommand $*(`{seq 5 $#*})
    
  • es:

      myCommand $*(5 ...)
    

For positional parameters starting from the 5th one:

  • zsh or yash.

      myCommand "${@[5,-1]}"
    
  • ksh93, bash or zsh:

      myCommand "${@:5}"
    
  • Bourne-like shells (includes all of the above shells)

      (shift 4; myCommand "$@")
    
  • csh-like shells:

      (shift 4; myCommand $argv:q)
    
  • fish:

      myCommand $argv[5..-1]
    
  • rc:

      @{shift 4; myCommand $*}
    
  • rc/es:

      myCommand $*(`{seq 5 $#*})
    
  • es:

      myCommand $*(5 ...)
    

For positional parameters starting from the 5th one:

  • zsh or yash.

      myCommand "${@[5,-1]}"
    
  • ksh93, bash or zsh:

      myCommand "${@:5}"
    
  • Bourne-like shells (includes all of the above shells)

      (shift 4; myCommand "$@")
    

(using a subshell so the shift only happens there).

  • csh-like shells:

      (shift 4; myCommand $argv:q)
    

(subshell)

  • fish:

      myCommand $argv[5..-1]
    
  • rc:

      @{shift 4; myCommand $*}
    

(subshell)

  • rc/es:

      myCommand $*(`{seq 5 $#*})
    
  • es:

      myCommand $*(5 ...)
    
added 125 characters in body
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

For positional parameters starting from the 5th one:

In zsh or yash.

myCommand "${@[5,-1]}"

In ksh93, bash or zsh:

myCommand "${@:5}"

Bourne-like shells (includes all of the above shells)

(shift 4; myCommand "$@")

csh-like shells:

(shift 4; myCommand $argv:q)

fish:

myCommand $argv[5..-1]
  • zsh or yash.

      myCommand "${@[5,-1]}"
    
  • ksh93, bash or zsh:

      myCommand "${@:5}"
    
  • Bourne-like shells (includes all of the above shells)

      (shift 4; myCommand "$@")
    
  • csh-like shells:

      (shift 4; myCommand $argv:q)
    
  • fish:

      myCommand $argv[5..-1]
    
  • rc:

      @{shift 4; myCommand $*}
    
  • rc/es:

      myCommand $*(`{seq 5 $#*})
    
  • es:

      myCommand $*(5 ...)
    

For positional parameters starting from the 5th one:

In zsh or yash.

myCommand "${@[5,-1]}"

In ksh93, bash or zsh:

myCommand "${@:5}"

Bourne-like shells (includes all of the above shells)

(shift 4; myCommand "$@")

csh-like shells:

(shift 4; myCommand $argv:q)

fish:

myCommand $argv[5..-1]

For positional parameters starting from the 5th one:

  • zsh or yash.

      myCommand "${@[5,-1]}"
    
  • ksh93, bash or zsh:

      myCommand "${@:5}"
    
  • Bourne-like shells (includes all of the above shells)

      (shift 4; myCommand "$@")
    
  • csh-like shells:

      (shift 4; myCommand $argv:q)
    
  • fish:

      myCommand $argv[5..-1]
    
  • rc:

      @{shift 4; myCommand $*}
    
  • rc/es:

      myCommand $*(`{seq 5 $#*})
    
  • es:

      myCommand $*(5 ...)
    
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k
Loading