meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| linux:bash [2023/11/23 06:57] – niziak | linux:bash [2026/05/05 12:13] (current) – niziak | ||
|---|---|---|---|
| Line 105: | Line 105: | ||
| </ | </ | ||
| - | ===== include/ | ||
| - | Possible test scenario: | ||
| - | - call using from another directory full path / | ||
| - | - add / | ||
| - | - create symlink to script and call using symlink. Check for relative and absolute symlinks. | ||
| - | - it should work also if it is sourced " | ||
| - | |||
| - | The best is to create setup/ | ||
| - | |||
| - | Another solutions: | ||
| - | <code bash> | ||
| - | #!/bin/sh | ||
| - | MY_DIR=$(dirname $(readlink -f $0)) | ||
| - | $MY_DIR/ | ||
| - | </ | ||
| - | |||
| - | <code bash> | ||
| - | DIR=$( cd "$( dirname " | ||
| - | </ | ||
| - | |||
| - | <code bash> | ||
| - | # Works correctly if script is sourced from another one | ||
| - | DIR=" | ||
| - | </ | ||
| - | |||
| - | <code bash> | ||
| - | cur_file=" | ||
| - | cur_dir=" | ||
| - | </ | ||
| - | |||
| - | '' | ||
| - | An array variable whose members are the source filenames where the | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | '' | ||