Created
March 15, 2019 16:35
-
-
Save hoggren/5f63ee9dec25b44bbcd440362fa4c886 to your computer and use it in GitHub Desktop.
Get all arguments into one array - without the application name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Test run: ./print-arguments.sh arg1 arg2 arg3 arg4 | |
# | |
# Author: Patrik Hoggren <p@hoggren.nu> | |
# https://www.github.com/phoggren | |
ARGS=("$@"); | |
# print ALL arguments | |
echo "${ARGS[*]}"; | |
# print first argument | |
echo "${ARGS[0]}"; | |
# print second argument | |
echo "${ARGS[1]}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment