Trying script fixes

Last login: Wed Jun 4 14:27:37 on ttys000

cliffordhackett@Cliffords-iMac ~ % #!/bin/zsh

# 1. Rename .save files if they exist and look like Python scripts

for file in *.py.save; do

[ -e “$file” ] || continue

newname=”${file%.save}”

mv “$file” “$newname”

echo “Renamed $file to $newname”

done

# 2. Make sure Python 3 is installed

if ! command -v python3 &> /dev/null; then

echo “Python3 not found. Installing with Homebrew…”

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

brew install python

fi

# 3. Run all .py files in the folder

for script in *.py; do

echo “Running $script…”

python3 “$script”

done

zsh: event not found: /bin/zsh

cliffordhackett@Cliffords-iMac ~ % >….

echo “Renamed $file to $newname”

done

# 2. Ensure Python 3 is installed

if ! command -v python3 &> /dev/null; then

echo “Python3 not found. Installing with Homebrew…”

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

brew install python

fi

# 3. Ensure the target directory exists

TARGET_DIR=”$HOME/Documents/bots”

if [ ! -d “$TARGET_DIR” ]; then

echo “Creating missing directory: $TARGET_DIR”

mkdir -p “$TARGET_DIR”

fi

# 4. Run all .py files in the current folder

for script in *.py; do

[ -e “$script” ] || continue

echo “Running $script…”

python3 “$script”

done

zsh: event not found: /bin/zsh

cliffordhackett@Cliffords-iMac ~ %

Leave a comment