Difference between revisions of "Bash Scripts"

From In The Wings
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
* [[lustre-server]]
 
* [[lustre-server]]
 
==Shell Tricks==
 
==Shell Tricks==
To get the name of the script sans the path:
+
To get the name of the script sans the path: [http://linux.ucla.edu/manual/bash-2.05a/html_node/bashref_29.html#SEC29 Explanation]
  
 
  SCRIPT=${0##*/}
 
  SCRIPT=${0##*/}
 +
==Tar Tricks==
 +
Copy files from one location to another using tar:
  
* [http://linux.ucla.edu/manual/bash-2.05a/html_node/bashref_29.html#SEC29 Explanation]
+
tar cf - . | (cd /somewhere ; tar xvfBp -)

Latest revision as of 17:21, 15 February 2017

University of Florida High Performance Computing Center

Shell Tricks

To get the name of the script sans the path: Explanation

SCRIPT=${0##*/}

Tar Tricks

Copy files from one location to another using tar:

tar cf - . | (cd /somewhere ; tar xvfBp -)