Created
July 24, 2025 10:17
-
-
Save ugovaretto/cdb2483a9be71ef367f0c185eb10a06c to your computer and use it in GitHub Desktop.
Link all files in a target path to files in the current directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# link-all.sh <target-dir> | |
# Used to link all ROCM .bc bitcode files to local files in order to use XLA and JAX | |
set -euo pipefail | |
[[ $# -eq 1 ]] || { echo "Usage: $0 <target-directory>" >&2; exit 1; } | |
target=${1%/} # strip trailing slash | |
[[ -d $target ]] || { echo "\"$target\" is not a directory" >&2; exit 1; } | |
shopt -s nullglob # empty patterns ⇒ nothing (instead of literal '*') | |
for file in "$target"/*; do | |
[[ -f $file ]] || continue # skip dirs, sockets, etc. | |
basename=${file##*/} # strip the path | |
ln -sv "$file" "$basename" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment