College, comfy-sounds & cleanup
Sep 27, 16 - 22:32pm, 1 year and 7 months ago
Aaand it’s back again to college, this year I’m doing A-level Maths & Physics with A2 Electronics, since last year I kinda screwded up Maths and Physics for reasons. Anyway, to the topic of this title, Comfy Sounds, is a little thing I’ve been working on over the week or so; I’ve been trying to stylize my code and really make everything as minimal as possible. In the past I previously just took a hamfisted approach to making things work without taking scalability into concern. The idea arose from my own need for white noise to play in the background whilst I was studying/typing up notes.
Another thing I made is a cleanup script, a bit more complicated than my previous one; which was just:
+#! /bin/bash +echo cleaning up... +cd /home/`whoami` +echo `pwd` +echo creating folder...s +mkdir images/ music/ docs/ video/ code/ images/art/ zips/ +echo moving files... +mv *.txt docs/ +mv *.jpg images/ +mv *.png images/ ...
And so on, this new script however uses fish’s
switch functions as shown:
# file type array for file in *.* # exclude directories switch $file case "*.txt" echo "Renaming" $file "to" (basename $file .txt)"_"$date_setting".txt" "and moving to" $doc_dir/ "..." mv $file (basename $file .txt)"_"$date_setting".txt" ; sleep $delay_time mv (basename $file .txt)"_"$date_setting".txt" $doc_dir/ ...
Initally the script shifts up all the files of Downloads/ and moves it into the Home folder it then echo’s what it is the script it doing to stdout, and then renames the file to the filename+date/time, and finally moves it to the corresponding folder, e.g.
$doc_dir/ = Documents/. It also supports a bit of file conversion using
You can download it here