Uploaded February 2016 | Updated September 2026, 2 weeks ago
How do arguments work in Bash scripting? How can my bash script accept input? Here's a quick video covering the basics of arguments in Bash scripting. Arguments are the data that you pass in when you call a script, like "scriptname argument1 argument 2".
In real life, this is something like 'tar zcf filename.tar.gz directory' ('zcf', 'filename.tar.gz', and 'directory' are the arguments in this example).
$# -- number of args that our script was run with
$0 -- the filename of our script
$1..$n -- script arguments
Full Bash Scripting Basics Playlist: youtube.com/playlist?list=PLtK75qxsQaMIlFCcFZpTBLnaCJ0I0uiaY
The only non-video Bash scripting resource you need: tldp.org/LDP/abs/html
Step-by-step project-based Linux course for beginners: udemy.com/course/hands-on-linux-self-hosted-wordpress-for-linux-beginners/?referralCode=19C0A7DEE2FD53C9C09D
Free Linux Sysadmin Course Playlist: youtube.com/playlist?list=PLtK75qxsQaMLZSo7KL-PmiRarU7hrpnwK
DigitalOcean referral link: https://m.do.co/c/0380a1db56a6
Patreon: patreon.com/tutorialinux
Official Site & e-mail list: tutorialinux.com
Twitter: twitter.com/tutorialinux
Facebook: facebook.com/tutorialinux
Podcast: kernelpanicpodcast.com
How do arguments work in Bash scripting? How can my bash script accept input? Here's a quick video covering the basics of arguments in Bash scripting. Arguments are the data that you pass in when you call a script, like "scriptname argument1 argument 2".
In real life, this is something like 'tar zcf filename.tar.gz directory' ('zcf', 'filename.tar.gz', and 'directory' are the arguments in this example).
$# -- number of args that our script was run with
$0 -- the filename of our script
$1..$n -- script arguments
Full Bash Scripting Basics Playlist: youtube.com/playlist?list=PLtK75qxsQaMIlFCcFZpTBLnaCJ0I0uiaY
The only non-video Bash scripting resource you need: tldp.org/LDP/abs/html
Step-by-step project-based Linux course for beginners: udemy.com/course/hands-on-linux-self-hosted-wordpress-for-linux-beginners/?referralCode=19C0A7DEE2FD53C9C09D
Free Linux Sysadmin Course Playlist: youtube.com/playlist?list=PLtK75qxsQaMLZSo7KL-PmiRarU7hrpnwK
DigitalOcean referral link: https://m.do.co/c/0380a1db56a6
Patreon: patreon.com/tutorialinux
Official Site & e-mail list: tutorialinux.com
Twitter: twitter.com/tutorialinux
Facebook: facebook.com/tutorialinux
Podcast: kernelpanicpodcast.com










