About 6,130,000 results
Open links in new tab
  1. linux - What does $@ mean in a shell script? - Stack Overflow

    Apr 3, 2012 · In brief, $@ expands to the arguments passed from the caller to a function or a script. Its meaning is context-dependent: Inside a function, it expands to the arguments passed to such function. If used in a script (outside a function), it expands to the arguments passed to such script. $ cat my-script #! /bin/sh echo "$@" $ ./my-script "Hi!" Hi!

  2. bash - What are the special dollar sign shell variables ... - Stack ...

    Sep 14, 2012 · Take care with some of the examples; $0 may include some leading path as well as the name of the program. Eg save this two line script as ./mytry.sh and the execute it. #!/bin/bash echo "parameter 0 --> $0" ; exit 0 Output: parameter 0 --> ./mytry.sh This is on a current (year 2016) version of Bash, via Slackware 14.2

  3. bash - What is the purpose of "&&" in a shell command? - Stack …

    See man set: in an "AND-OR list" it will ignore anything but the last command according to the manpage, so as I understand it, if you expect it to stop the entire script on the first failure in such a list, it will not. –

  4. Meaning of $? (dollar question mark) in shell scripts

    Aug 1, 2019 · In Bash, when you hit enter, a fork + exec + wait happens like above, and bash then sets $? to the exit status of the forked process. Note: for built-in commands like echo, a process need not be spawned, and Bash just sets $? to 0 to simulate an …

  5. bash - Shell equality operators (=, ==, -eq) - Stack Overflow

    (From the Bash man page: "Any part of the pattern may be quoted to force it to be matched as a string."). Here in Bash, the two statements yielding "yes" are pattern matching, other three are string equality:

  6. What does -z mean in Bash? - Stack Overflow

    Aug 7, 2013 · check if variable exist using if else bash script. 1. What does [[ -z "path" ]] mean in bash. 0.

  7. bash - What does the operator != mean in a shell script ... - Stack ...

    Nov 19, 2013 · The thing is, what you pass to if in bash is already a command to run; the then block is executed if the command exits with status 0. So the [ ... ] brackets are just another shell command, one that interprets the expression and exits with status 0 if it's true and 1 if it's false.

  8. What do the -n and -a options do in a bash if statement?

    In bash the test command will be a built-in command; try type [to learn its type. For built-in commands help will show usage, so also run help [ to see documentation. Your system probably also has a /bin/[ and a /bin/test and if you man test you can see the manuals for those.

  9. Transfer files using lftp in a Bash script - Stack Overflow

    I have server A test-lx, and server B test2-lx, I want to transfer files from server A to server B. While transferring the files, I'll need to create a directory only if it does not exist. How can I

  10. How can I parse a YAML file from a Linux shell script?

    Feb 16, 2011 · #!/bin/bash # Read values directly from YAML (or EYAML, JSON, etc) for use in this shell script: myShellVar=$(yaml-get --query=any.path.no[matter%how].complex source-file.yaml) # Use the value any way you need: echo "Retrieved ${myShellVar}" # Perhaps change the value and write it back: myShellVar="New Value" yaml-set --change=/any/path/no ...

Refresh