Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Have you heard of getopts? Commented Sep 4, 2021 at 15:43
  • Reading up on that right now Commented Sep 4, 2021 at 16:17
  • Eh, which one do you want? To use the command line arguments, like the +x in chmod +x, meaning the user would run bash script.sh whatever<enter> (or preferably just script.sh whatever<enter> after you set the execute permission and hashbang correctly, and place the script in $PATH). Or do you want to read input from the user after the script starts, in which case the user would run something like script.sh<enter>whatever<enter> (or if you want to read just a single keystrike without enter, you can do that too) Commented Sep 4, 2021 at 16:31
  • The first one, yes. I've tried to search for the answer, but haven't really found anything much. Commented Sep 4, 2021 at 16:41