DEV Community

Discussion on: Shellscripting: Functions

Collapse
 
moopet profile image
Ben Sinclair

Just to be picky about positionals, when you say

NOTE: You cannot change the values of these variables

You kinda can, because you can use shift to reposition them,

foo() {
  echo $1, $2, $3
  shift
  echo $1, $2, $3
}

foo one two three four five

# one, two, three
# two, three, four
Enter fullscreen mode Exit fullscreen mode
Collapse
 
puritanic profile image
Darkø Tasevski

Each day you learn something new :D Thanks!