Geek Garage

Find inspiration in awesome ideas.

Tag: Shell

Be efficient in your shell command trough outputs

I just read a tutorial about configuring Apache where you had to create a conf file based on your username. The tutorial reminded that you can get your username trough the whoami command. So this is the two commands you should issue.

whoami
touch username.conf

Two commands and a copy & past. Not cool as there is a far easier way. Remember that you canĀ get the result of a command while using Bash. Historically, it was trough theĀ backticks, but today, $(…) is preferred. So, rather than two lines and a copy & past, prefer this single line

touch $(whoami).conf

This way, you don’t have to worry about the username. Even better, ou can use this in a shell script.

Easily delete jpg files when shooting RAW+jpg

As a photographer, I always shoot in RAW files. But unfortunately, my Canon G11 cannot be set for only RAW files. If I want a RAW file, it will be a RAW+jpg. So, I always have to get ride of the jpgs once unloaded on my computer. In the easiest scenario, I could just delete all the jpgs files once exported.

But the G11 is the family camera. My wife sometimes shoot in the green square mode. When set to the green square, there is no RAW file, only jpg. So if I unload the pictures, I cannot just delete the jpgs as I will delete those pictures which exists only as jpgs.

I could check every file and delete it by hand, but we use computers, they should do the job. Actually, the job can be done by a 10 lines shell script.

Read More

Powered by WordPress & Theme by Anders Norén