This is a collection of (currently one) scripts I made to make life a little easier.
After cloning this repository, check if the permissions have been set correctly to allow executing the scripts. You can do so by navigating to the directory in your Terminal app and running one of the two following commands:
On Linux
if [ -z "$(find . -type f ! -name ".*" -regex '.*[^.]$' ! -executable)" ]; then
echo "All scripts have the correct permissions."
else
echo "The permissions for some or all scripts need to be changed."
fiOn macOS
if [ -z "$(find . -type f ! -name ".*" -regex '.*[^.]$' ! -perm -u+x)" ]; then
echo "All scripts have the correct permissions."
else
echo "The permissions for some or all scripts need to be changed."
fiThis command will find all files in the current directory that are not hidden and have no file extension, and check their permissions. On Linux it uses -executable and on macOS is checks if the executable bits are set.
If the results indicate that modifications need to be made, either chmod the script files yourself, or run the following command (same on Linux and macOS). It changes the permissions of all files that are not hidden and have no file extention, to allow execution. You will need to authorise this with your password, and if you don’t understand what you’re doing, please stop here and refer to the linked tutorials at the beginning of the "How to use" section!
find . -type f ! -name ".*" -regex '.*[^.]$' -exec chmod +x {} + \
&& echo "Permissions for files without extensions have been set to executable."If you’re like me, and you want to be able to execute these scripts in the Terminal as if they were apps, you’ll need to add the correct PATH-export to your Terminal configuration.
Example: On macOS with Apple Terminal, and if you cloned this repository to ~/Developer/Custom Bash Commands/ you’ll need to modify ~/.zshrc like this:
echo 'export PATH="$HOME/Developer/Custom Bash Commands:$PATH"' >> ~/.zshrc && source ~/.zshrcThis command takes an MKV- and optionally an additional SRT-file, and converts them using ffmpeg into one MP4 file using HEVC (H.265). It will default to marking audio and subtitle tracks as German ("deu"), for English use "eng".
This command takes an MP4 and an SRT file of the same name and optionally a language parameter and replaces the subtitles inside the MP4 with the SRT file’s contents.