Difference between revisions of "$1"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash | https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash | ||
− | [[if]] [ -n "$1" ]; then | + | [[if]] [ [[-n]] "$1" ]; then |
echo "You supplied the first parameter!" | echo "You supplied the first parameter!" | ||
else | else |
Revision as of 10:59, 3 November 2021
https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash
if [ -n "$1" ]; then echo "You supplied the first parameter!" else echo "First parameter not supplied." fi
See also
Bash [ -c ]
,alias
,&&
, Bash history, Autocompletion,set
,unset
,export
,.bash_aliases, .bashrc and .bash profile
,PS1
,echo
,brace expansion
, Function,shopt
,trap
,set -e
,source
,PATH
,complete
,disown
,.hushlogin
,.bashrc
,builtin
,eval
,set
,$PATH
,$HOME
,TZ
,.profile
,-e, -i
,Builtin (Bash)
,mapfile
,~
, return (Bash), for, until,declare, dirname, basename, functions.sh
, Bash arithmetic expansion,shift, bash --rcfile, readonly, $1, $@
Advertising: