About 80 results
Open links in new tab
  1. What is the meaning of $? in a shell script? - Unix & Linux Stack …

    Feb 20, 2011 · This latter usage is faster, does not contaminate the shell's variable namespace with what amounts to temp variables, can often be a lot more readable for humans and encourages the …

  2. Linux Bash Shell Script Error: cannot execute: required file not found

    Oct 21, 2022 · It does not seem to matter if you wrote your bash script from another Linux system first. It is the act of cloning a repo to a Windows FS which breaks everything. The only solution I know of …

  3. bash - Shell script with getopt for short and long options -handling ...

    Aug 2, 2025 · The bash built-in getopts supports only short options. I tend to use the built-in getopts for very simple scripts...and used to use getopt for more complex shell scripts but these days I don't …

  4. shell - How can I get the size of a file in a bash script? - Unix ...

    Jul 13, 2011 · How can I get the size of a file in a bash script? How do I assign this to a bash variable so I can use it later?

  5. Passing named arguments to shell scripts - Unix & Linux Stack Exchange

    $ ./my_script -p '/some/path' -a5 Argument p_out is /some/path Argument arg_1 is 5 There is a helpful Small getopts tutorial or you can type help getopts at the shell prompt. Edit: The second case …

  6. Different ways to execute a shell script - Unix & Linux Stack Exchange

    Most people debug shell scripts by adding the following debuging flags to the script: set -x # Print command traces before executing command. set -v # Prints shell input lines as they are read. set -xv …

  7. How can I create a select menu in a shell script? - Ask Ubuntu

    I'm creating a simple bash script and I want to create a select menu in it, like this: $./script echo "Choose your option:" 1) Option 1 2) Option 2 3) Option 3 4) Quit And according to u...

  8. Precedence of the shell logical operators - Unix & Linux Stack Exchange

    This has confused me a lot in trying to write shell script pipelines with different logic based on some test (e.g. exiting if a file doesn't exist vs continuing the pipeline).

  9. How to get my own IP address and save it to a variable in a shell script?

    Nov 18, 2015 · How to get my own IP address and save it to a variable in a shell script? Ask Question Asked 15 years, 1 month ago Modified 2 years, 2 months ago

  10. Not able to execute a .sh file: /bin/bash^M: bad interpreter

    Jun 7, 2013 · 0 I had developed the bash script on a Mac, so the first line of the script was #!/opt/homebrew/bin/bash When I tried to run it on ubuntu, I got the bad-interpreter issue. I changed …