#!/bin/bash #put a list of all threads into /tmp/all_procs ps -eL > /tmp/all_procs #filter out everything that has 'httpd' in it and put in /tmp/httpd_procs cat /tmp/all_procs | grep httpd > /tmp/httpd_procs #count all lines in /tmp/httpd_procs and store count in /tmp/num_httpd_procs cat /tmp/httpd_procs | wc -l > /tmp/num_httpd_procs #copy num_httpd_procs to desktop cp /tmp/num_httpd_procs /home/mdrago #remove temporary files rm /tmp/num_httpd_procs rm /tmp/httpd_procs rm /tmp/all_procs
dir="/home/mdrago/Desktop/BashTalk/Scripts" for file in `ls $dir`; do wc $dir/$file done
for ((i=0; i <= 10; i++)); do echo $i done
var=10 if [ $var -eq 10 ]; then echo 'var equals 10' fi
file='/home/mdrago/filename' if [ -e $file ]; then echo "$file exists" else echo "$file does not exist" fi
for file in `ls *.jpg`; do convert "$file" -resize 800x600 small-$file done
#!/bin/bash dir="Thumbnails-$1" mkdir -p $dir for file in `ls *.jpg`; do convert "$file" -resize $1 $dir/$file done
#!/bin/bash
tempfile='/tmp/dialog'
dialog --ok-label 'Resize' --inputbox 'Enter Desired Image Size' 8 30 '800x600' 2> $tempfile
exitstatus=$?
size=`cat $tempfile`
if [ $exitstatus -eq 0 ]; then
dir="Thumbnails-$size"
mkdir -p $dir
for file in `ls *.jpg`; do
convert "$file" -resize $size $dir/$file
done
fi
#!/bin/bash
size=`zenity --entry --title='ResizePics' --text='Enter the desired size for th\e selected pictures.' --entry-text='800x600'`
dir="Thumbnails-$size"
mkdir -p $dir
for file in $@
do
#get just the filename
shortfile=`basename "$file"`
#convert to smaller size and store in $dir
convert -size $size "$file" -resize $size "$dir/$shortfile"
done
#!/bin/bash
size=`zenity --entry --title='ResizePics' --text='Enter the desired size for the selected pictures.' --entry-text='800x600'`
dir="Thumbnails-$size"
mkdir -p $dir
num_done=0
total=$#
(for file in $@
do
#get just the filename
shortfile=`basename "$file"`
#convert to smaller size and store in $dir
convert -size $size "$file" -resize $size "$dir/$shortfile"
num_done=$(($num_done+1))
percent=$(($num_done*100/total))
echo $percent
done) | zenity --progress --title="ResizePics" --text="Resizing Pictures to $size"