https://github.com/scottstanfield/whatdir
Wiring up a link to run a bash script to launch Python code
https://github.com/scottstanfield/whatdir
bash readlink scripting
Last synced: about 1 month ago
JSON representation
Wiring up a link to run a bash script to launch Python code
- Host: GitHub
- URL: https://github.com/scottstanfield/whatdir
- Owner: scottstanfield
- Created: 2017-12-17T19:48:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-17T19:51:55.000Z (over 8 years ago)
- Last Synced: 2025-10-20T21:41:17.434Z (8 months ago)
- Topics: bash, readlink, scripting
- Language: Shell
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Toy example demonstrating paths and readlink and linked bash scripts
This is how you symlink a pointer to a bash executable that calls a
Python script. It's all about managing paths with GNU `readlink`.
Only works in Linux. For Mac, you need GNU `readlink` (install from brew
install coreutils) and change script to call `greadlink`
To test, clone this repo to a tmp folder somewhere like ~/tmp/whatdir.
Then:
```
./install.sh
cd ~
./whatdir
```
- `~/whatdir` is linked to `~/tmp/whatdir/main.sh`
- `main.sh` figures out local path and executes `main.py`
- `main.py` arbitrarily imports another python file in current folder