Difference between revisions of "Bash -c"

From wikieduonline
Jump to navigation Jump to search
(Created page with "* https://stackoverflow.com/questions/20858381/what-does-bash-c-do == See also == * {{Bash}} Category:Bash")
Tags: Mobile web edit, Mobile edit
 
 
(21 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{lc}}
 
* https://stackoverflow.com/questions/20858381/what-does-bash-c-do
 
* https://stackoverflow.com/questions/20858381/what-does-bash-c-do
  
 +
-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>
 +
 +
[[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 ==
 +
* <code>[[bash -e]]</code>
 +
* <code>[[bash -x]]</code>
 +
* <code>[[bash -xe]]</code>
 +
* <code>[[bash -i]]</code>
 +
* <code>[[bash --rcfile]] .mybashrc -ci 'echo $FOO'</code>
 +
* <code>[[sh -c]]</code>
 +
* <code>[[bash --login]]</code>
  
 
== See also ==
 
== See also ==
 +
* {{command}}
 
* {{Bash}}
 
* {{Bash}}
  
 
[[Category:Bash]]
 
[[Category:Bash]]

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'
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]

See also[edit]

Advertising: