Greetings List,
I have an old shell script which I needed to use today and ran into a problem
which I haven’t been able to figure out. I still have the BBEdit help file I
wrote for myself years ago, but the instructions don’t seem to be working. I
have two versions of the script, one for .txt files, and one for .html files.
I have been trying to use the script to add the file name of each file to the
top and bottom of over 700 BBEdit files. However, after dropping the shell
script into the Terminal window, and then dragging the selected folder full of
files to the Terminal, and then removing the ending space and hitting my return
key, I get an error for every single file in the folder which says “no such
file or folder found".
I have placed the script both on the desktop, as well as in my Home folder.
Likewise, I have done the same for the folder containing the 700+ BBEdit files.
But no matter what I do, or where I place the script and folder, I still keep
getting the error.
I am not sure what I am doing wrong.
I am currently running Sequoia 15.5 on a 2023 Apple Studio if that is of any
help.
Did Apple do something which makes these two scripts no longer work properly,
or am I just forgetting how to do this properly?
Below is the contents of both scripts. They are identical except for the fact
that one has “html" in it, while the other has “txt" in it.
#!/usr/bin/env bash
directory="$1/*.txt"
for f in $directory
do
echo "Processing $f..."
fullfile="$f"
filename=$(basename "$fullfile")
filename_woext="${filename%.*}"
sed -i '' "s/#BASENAME#/$filename_woext/g" $fullfile
done
#!/usr/bin/env bash
directory="$1/*.html"
for f in $directory
do
echo "Processing $f..."
fullfile="$f"
filename=$(basename "$fullfile")
filename_woext="${filename%.*}"
sed -i '' "s/#BASENAME#/$filename_woext/g" $fullfile
done
Thanks in advance to anyone who can help.
Kind Regards,
Bill Kochman
--
This is the BBEdit Talk public discussion group. If you have a feature request
or believe that the application isn't working correctly, please email
"[email protected]" rather than posting here. Follow @bbedit on Mastodon:
<https://mastodon.social/@bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/bbedit/CD71B3FF-B1C9-4BEB-9CE8-82053C11265A%40gmail.com.