#!/bin/bash
# Check if a prefix is supplied
if [ -z "$1" ]; then
echo "Usage: $0 <prefix>"
exit 1
fi
# Define the source directory and the prefix
SOURCE_DIR=~/og_files
PREFIX=$1
# Loop through files with the specified prefix and create symlinks
for file in "$SOURCE_DIR"/"$PREFIX"*; do
if [[ $(basename "$file") != "$PREFIX"d* ]]; then
ln -s "$file" .
echo "Created symlink for $(basename "$file")"
fi
done
1. Create Bash Script
Put all the bash code below into a new bash script (e.g. do_symlinks.sh)
2. Copy or Move /usr/local/bin and Source .bashrc
sudo cp do_symlinks.sh /usr/local/bin/do_symlinks && . ~/.bashrc3. Create and change directory into test1 folder
mkdir test1 && cd test14. Run do_symlinks tony_
do_symlinks tony_5. Confirm results ll
ll6. Terminal Code
sudo cp do_symlinks.sh /usr/local/bin/do_symlinks && . ~/.bashrc
mkdir test1 && cd test1
do_symlinks tony_
ll7. Screenshots of Code

