Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

About Custom Bash Scripts

This is a collection of (currently one) scripts I made to make life a little easier.

Table of Contents

How to use

⚠️ If you’re new to using the command line, on a Mac, study the Terminal User Guide first, or on Linux try Ubuntu’s the Linux command line for beginners guide.

Installation

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."
fi

On 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."
fi

This 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."

Using scripts as if they were apps

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 ~/.zshrc

Available scripts

mkvtohevc filename [--alang language --slang language]: Convert MKV and SRT files to HEVC MP4-files

This 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".

srtreplace filename [--lang]: Replace the subtitles in an MP4 file

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages