Scripting

Resize of images in a folder with imagemagick

#!/bin/bash # Hans-Henry Jakobsen # Script som bl.a resizer bilder og legger de i rett mappe # NB! ikke bruk originalfil da dette script sletter fila # Sjekker at mapper eksisterer if [ ! -d 320 ] then mkdir 320 fi if [ ! -d 480 ] then mkdir 480 fi for file in $(ls|grep […]

Read More
Scripting

Reverse text content in file

#!/bin/bash # Bash shell script to reverse text file contain i.e. concatenate files and # print on the standard output in reverse. This script also demonstrate how # to use arrays under bash shell script. FILE=”$1″ if [ $# -eq 0 ]; then echo “$(basename $0) – file-name” exit 1 fi textArray[0]=”” # hold text […]

Read More
Scripting

Rename files from upper- to lowercase or vice versa

#!/bin/bash # # Shell script to rename given file names to from uppercase to # lowercase OR lowercase to uppercase FILES=”$1″ ME=”$(basename $0)” # function to display message and exit with given exit code function die(){ echo -e “$1” exit $2 } # exit if no command line argument given [ “$FILES” == “” ] […]

Read More