Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash parameter count

# use $#

# say if you are expecting exactly 2 parameters
# -ne is bash's way of saying not equal
if [[ "$#" -ne 2 ]]; then
	echo "this script needs exactly 2 parameters"
    exit 1
 fi
Comment

bash count number of arguments

The number of arguments is $#
Comment

PREVIOUS NEXT
Code Example
Shell :: zsh: command not found: conda 
Shell :: ubuntu install codecs 
Shell :: how to install flatpak ubuntu 
Shell :: sql like bracket 
Shell :: find folder in centos 8 
Shell :: install auth in laravel 8 with bootstrap 
Shell :: list all ppa repository ubuntu 
Shell :: how to remove the last character terminal 
Shell :: dconf editor ubuntu 20.04 
Shell :: upgrade ubuntu 16.04 to 20.04 
Shell :: generate service ionic 
Shell :: jupyter notebook venv 
Shell :: anaconda navigator linux command 
Shell :: how to check if oh my zsh is installed 
Shell :: how to install vlc in fedora 
Shell :: uninstall vue from my system 
Shell :: how to change account in git bash 
Shell :: how to delete services in kubernetes 
Shell :: git set name and email 
Shell :: npm fix deprecated packages globally 
Shell :: blackeye github 
Shell :: git reset head to remote 
Shell :: bash random number 
Shell :: change zsh to bash 
Shell :: wget ignore ssl cert error 
Shell :: clear cache credential git 
Shell :: git reset keep changes 
Shell :: git get last commit id 
Shell :: open firewall port in ububut 
Shell :: The upstream branch of your current branch does not match the name of your current branch. 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =