Difference between revisions of "Bash -c"
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
-c string. If the -c option is present, then [[commands]] are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0. | -c string. If the -c option is present, then [[commands]] are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0. | ||
+ | DIR="YOUR_DIR" bash -c 'tar c "$DIR" | [[xz -T0 -c]] > "$DIR".tar.xz && ls -lh "$DIR".tar.xz' | ||
* [[Homebrew installation]]: <code>/bin/bash -c "$([[curl]] -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"</code> | * [[Homebrew installation]]: <code>/bin/bash -c "$([[curl]] -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"</code> | ||
+ | |||
+ | [[DD_AGENT_MAJOR_VERSION]]=7 [[DD_API_KEY]]=XXXXXXXXXXXXXX DD_SITE="datadoghq.com" [[bash -c]] "$(curl -L https://install.datadoghq.com/scripts/install_mac_os.sh)" | ||
== Related == | == Related == | ||
* <code>[[bash -e]]</code> | * <code>[[bash -e]]</code> | ||
* <code>[[bash -x]]</code> | * <code>[[bash -x]]</code> | ||
− | * [[bash -xe]] | + | * <code>[[bash -xe]]</code> |
* <code>[[bash -i]]</code> | * <code>[[bash -i]]</code> | ||
* <code>[[bash --rcfile]] .mybashrc -ci 'echo $FOO'</code> | * <code>[[bash --rcfile]] .mybashrc -ci 'echo $FOO'</code> | ||
* <code>[[sh -c]]</code> | * <code>[[sh -c]]</code> | ||
+ | * <code>[[bash --login]]</code> | ||
== See also == | == See also == |
Latest revision as of 12:59, 4 June 2024
-c string. If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0.
DIR="YOUR_DIR" bash -c 'tar c "$DIR" | xz -T0 -c > "$DIR".tar.xz && ls -lh "$DIR".tar.xz'
- Homebrew installation:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
DD_AGENT_MAJOR_VERSION=7 DD_API_KEY=XXXXXXXXXXXXXX DD_SITE="datadoghq.com" bash -c "$(curl -L https://install.datadoghq.com/scripts/install_mac_os.sh)"
Related[edit]
bash -e
bash -x
bash -xe
bash -i
bash --rcfile .mybashrc -ci 'echo $FOO'
sh -c
bash --login
See also[edit]
command, bash -c
Bash [ -c ]
,alias
,&&
, Bash history, Autocompletion,set
,unset
,export
,.bash_aliases, .bashrc and .bash profile
,PS1
,echo
,brace expansion
, Function,shopt
,trap
,set -e
,source
,PATH
,complete
,disown
,.hushlogin
,.bashrc
,builtin
,eval
,set
,$PATH
,$HOME
,TZ
,.profile
,-e, -i
,Builtin (Bash)
,mapfile
,~
, return (Bash), for, until,declare, dirname, basename, functions.sh
, Bash arithmetic expansion,shift, bash --rcfile, readonly, $1, $@
Advertising: