YOUR BFF WHEN IT COMES TO THE BEST LINUX & OPEN SOURCE NEWS & RESOURCES

JOIN
Videos

Bash Scripting 5 — Arguments

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: https://www.youtube.com/playlist?list=PLtK75qxsQaMIlFCcFZpTBLnaCJ0I0uiaY

The only non-video Bash scripting resource you need: http://tldp.org/LDP/abs/html/

Step-by-step project-based Linux course for beginners: https://www.udemy.com/course/hands-on-linux-self-hosted-wordpress-for-linux-beginners/?referralCode=19C0A7DEE2FD53C9C09D

Free Linux Sysadmin Course Playlist: https://www.youtube.com/playlist?list=PLtK75qxsQaMLZSo7KL-PmiRarU7hrpnwK

DigitalOcean referral link: https://m.do.co/c/0380a1db56a6

Patreon: https://www.patreon.com/tutorialinux
Official Site & e-mail list: https://tutorialinux.com/
Twitter: https://twitter.com/tutorialinux
Facebook: https://www.facebook.com/tutorialinux
Podcast: http://kernelpanicpodcast.com

0 0 votes
Article Rating
Show More

getFOSSD

https://t.me/getfoss

Related Articles

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
Back to top button
0
Would love your thoughts, please comment.x
()
x
Get Support!