Skip to content

Instantly share code, notes, and snippets.

@junhan-z
Created December 2, 2019 21:53
Show Gist options
  • Save junhan-z/232c0599477eb7f0cd3c0b0e29fbf79a to your computer and use it in GitHub Desktop.
Save junhan-z/232c0599477eb7f0cd3c0b0e29fbf79a to your computer and use it in GitHub Desktop.
To reference the last argument passed to a script
args=$# # Number of args passed.
lastarg=${!args}
# or:
# lastarg=${!#}
echo $lastarg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment