dilemma by my hands, one of which I don't even know how to prhase it out to ask it to our God Father Google:
how do I source a file in bash based on the sourcing script and not the relative path of the shell prompt at that specific time?
I'll explain myself a little bit better:
I have this directory structure
/home/bryanpedini/projects/personal-linux-config
├── bashrc_overrides
│ ├── _all
│ ├── colored_commands
│ ├── convenience_aliases
│ ├── git_functions
│ ├── histcontrol
│ ├── home_bin_folder
│ ├── ls_aliases
│ ├── safety_aliases
│ ├── terminal_colors
│ ├── terminal_fancyfying
│ └── terminal_fancyfying_server
├── deploy.sh
├── LICENSE
└── README.md
I would like the _all file to source the other files, the issue is that I would have to source based on the current path of the _all file and not the path where my prompt is at that time (could be ~, could be /, could be whatever)
also, this, because I need the ability to move the directory from /home/bryanpedini..... to /path/to/whatever and just update the reference to the _all file in ~/.bashrc and not every reference of every file...
Isn't it easier to just get the path to the _all script? There's a one-liner for that https://stackoverflow.com/questions/59895/how-can-i-get-the-source-directory-of-a-bash-script-from-within-the-script-itsel
the script is not executed, it is sourced
actually, I'm wrong, the thing I use in the deploy.sh script (which is SCRIPT_DIR="$(dirname "$(readlink -fm "$0")")" to be precise) doesn't work, this solution did...
Обсуждают сегодня