Difference between revisions of "Bash -c"

From wikieduonline
Jump to navigation Jump to search
 
(2 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>
Line 14: Line 15:
 
* <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 15:57, 18 February 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'

Related[edit]

See also[edit]

Advertising: