BASH Script for Kazam
I like Kazam as a screencast recorder, but it insists on saving to ~/Videos rather than my chosen subdirectory. A small hashtag#bash script solves the problem:
Using a for loop
iterate through the latest recordings and move each one into the desired subdirectory, with a suitably incremented basename.
#!/bin/bash
video_dir=~/Videos
kazam_dir="$video_dir/Kazam_Screencasts"
for VIDEO in $(ls ~/Videos/Kazam_screencast*.mp4)
do
number=$(basename $(ls $kazam_dir -v1 | tail -n 1) ".mp4" | grep -o '[0-9]\+')
new_number=$((10#$number + 1))
printf -v new_number "%05d" "$new_number"
new_basename="Kazam_screencast_$new_number.mp4"
mv $VIDEO "$kazam_dir/$new_basename"
done
Published on 20 Apr 2024
all tags
100daysofcode activerecord android annoyances api apt arch array artix atom az3w backend bash blog browser bug callback career ci-cd cli cloud code coding config configuration cp crud cryptography css csv database db design devops django docker email erp feelsgood filter fugitive gif gist git gnome gnome pomodoro grep hebrew http ide isbn-fetcher iso javascript job search js kanban kindle koans learning linkedin linux logger manjaro map markdown microservices mobi mtp neovim nodejs nvchad packages panda pastbin patch portfolio post postgres pytest python rails reduce refactoring reflections rest routes rspec ruby salesforce script scripting security sed shell sql string_replacement study tdd terminal testing tmux ttd version_control vim vim sort walkthrough webdev workflow zsh