Difference between revisions of "Dirname"

From wikieduonline
Jump to navigation Jump to search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{lowercase}}
 
{{lowercase}}
<code>dirname</code> command included in <code>[[coreutils]]</code> package.
+
<code>dirname</code> <ref> https://man7.org/linux/man-pages/man1/dirname.1.html</ref> command included in <code>[[coreutils]]</code> package.
* https://man7.org/linux/man-pages/man1/dirname.1.html
 
  
 
  [[cd]] -- "$(dirname "$0")"
 
  [[cd]] -- "$(dirname "$0")"
  
 
  dirname -- "$0";
 
  dirname -- "$0";
 +
 +
dirname -- "$( [[readlink]] -f -- "$0"; )";
  
 
== Related terms ==
 
== Related terms ==
Line 12: Line 13:
 
* <code>[[mkdir -p]]</code>
 
* <code>[[mkdir -p]]</code>
 
* <code>[[mkdir -p]] "$(dirname "$1")" && [[touch]] "$1"</code>
 
* <code>[[mkdir -p]] "$(dirname "$1")" && [[touch]] "$1"</code>
 +
* <code>[[BASH_SOURCE]]</code>
 +
* <code>script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)</code>
  
 
== See also ==
 
== See also ==

Latest revision as of 10:12, 28 March 2024

Advertising: