Difference between revisions of "Dirname"

From wikieduonline
Jump to navigation Jump to search
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")"

Revision as of 04:25, 12 February 2024

dirname [1] command included in coreutils package.

cd -- "$(dirname "$0")"
dirname -- "$0";
dirname -- "$( readlink -f -- "$0"; )";

Related terms

script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)

See also

  • https://man7.org/linux/man-pages/man1/dirname.1.html
  • Advertising: