recentpopularlog in

shellscripts

Change the Delay When Dragging Windows Within Spaces on Mac | OSXDaily
“You may have noticed that there’s a delay when dragging a window to a new space, which is handy for not accidentally dragging windows into a new Space but kind of annoying if you are expecting it to enter a new workspace instantly. The instant switching of workspaces is a lot closer to how these workspace managers, or ‘virtual desktops’ work in the Unix world, and if you have a background of using a Linux desktop you may miss that instant desktop switching.”
spaces  mac  macos  osx  2016  terminal  shellscripts 
december 2017 by handcoding
UNIX Shell Quotes - a simple tutorial
All about how to deal with quoting in shell script
bash  shellscripts 
july 2014 by pholbrook
Bash and Dash
Useful Bash functions for invoking Dash.
bash  shellscripts  dash 
may 2014 by pholbrook
CVS-RCS- HOW-TO Document for Linux (Source Code Control System): RCS Shell Scripts
##12. RCS Shell Scripts

If you want to use RCS instead of CVS then you can use the following shell scripts.
###12.1 cotree.sh

#!/bin/ksh

# cotree.sh (Check Out Tree shell script)
# cotree.sh - Check out the entire RCS directory

# Usage :
# This will get the all the directories
# unix> cotree.sh
#
# This will get just one single directory tree
# unix> cotree.sh <directory name>

# See also cofiles.sh

###############################################################
# Setting up RCS (Revision Control System)
# Install the RCS programs - which gives command co, ci, rcslog
# Create a rcs home directory where you want to put all the
# source code repository. Call this $RCSDIR=/home/rcs_version_control
# Setup up an environment variable RCSDIR=/home/rcs_version_control
# in $HOME/.profile file. Like -
# export RCSDIR=/home/rcs_version_control
# Create a directory structure under $RCSDIR and check in all your
# files using ci . See 'man ci'
# Now create a link from your home directory to your project
# under $RCSDIR
# cd $HOME
# mkdir $HOME/myproject
# cd $HOME/myproject
# and run this script to get all the files and directory tree
# cotree.sh
# This script will create the entire source-tree under user's
# home and also will have a soft link to RCS directories. Each
# user will run this script under his home directory.
###############################################################

check_out_directory()
{
# Root directory of RCS (revision control system)
# like RCSDIR=/home/rcs_version_control
RCSDIR=$1
DIRNAME=$2

# The given directory name must exist in rcs root directory
if [ "$DIRNAME" = "" -o ! -d $RCSDIR/$DIRNAME ]; then
print "\nDirectory DIRNAME=$DIRNAME does not exist!!"
print "\nAborting the program ... and exiting...\n"
exit
fi

mkdir -p $DIRNAME
ln -s $RCSDIR/$DIRNAME/RCS $DIRNAME
(
cd $DIRNAME

# This fails in case of filename=sample,vv
# which inside RCS will be RCS/sample,vv,v
# ls RCS | cut -d',' -f1 | xargs co
# Use match to end of name $, as below -
# Use ls RCS/* to avoid getting the names ./ and ../
#ls RCS/* | cut -d'/' -f2 | sed -e's/,v$//g' | xargs co
if [ -d RCS ]; then
ls RCS/* | cut -d'/' -f2 | sed -e's/,v$//g' | \
while read ii
do
#echo "ii is : $ii"
if [ -f "RCS/$ii,v" ]; then
co $ii
fi
done
fi
)
}

# Root directory of RCS (revision control system)
# like RCSDIR=/home/rcs_version_control
if [ "$RCSDIR" = "" -o ! -d $RCSDIR ]; then
print "\nDirectory RCSDIR=$RCSDIR does not exist!!"
print "\nAborting the program ... and exiting...\n"
exit
fi
#echo "rcsdir is : $RCSDIR"

# If a directory argument is passed, then check out all
# files for this directory only and exit.
if [ "$1" != "" ]; then
(cd $RCSDIR; find $1 -type d -print ) |
while read DIRNAME
do
#echo DIRNAME=$DIRNAME
#DIRNAME=c_src
# Send rcs root directory and dir name relative to rcs root dir
tmpaa=` basename $DIRNAME `
if [ "$tmpaa" != "RCS" ]; then
check_out_directory $RCSDIR $DIRNAME
fi
done
else
(cd $RCSDIR; find * -type d -print ) |
while read DIRNAME
do
echo DIRNAME=$DIRNAME
#DIRNAME=c_src
# Send rcs root directory and dir name relative to rcs root dir
tmpaa=` basename $DIRNAME `
if [ "$tmpaa" != "RCS" ]; then
check_out_directory $RCSDIR $DIRNAME
fi
done
fi

###12.2 cofiles.sh

#!/bin/ksh

# cofiles.sh (Check Out files shell script)
# cofiles.sh - Check out all the files in current directory from RCS
# See also cotree.sh and 'man rcsclean'

if [ ! -d RCS ]; then
print "\nDirectory RCS does not exist!!"
print "\nAborting the program ... and exiting...\n"
exit
fi

#echo "No. of args = " $# " and all args " $@

while true
do
print -n "\n\nCheck-out all files in read-write mode? <y/n> [n]: "
read ans
if [ "$ans" = "" -o "$ans" = "n" -o "$ans" = "N" ]; then
ans="N"
break
elif [ "$ans" = "y" -o "$ans" = "Y" ]; then
ans="Y"
break
else
print "\nWrong entry! Try again!!"
fi
done
#echo "The ans is : " $ans

if [ $# -eq 0 ]; then
# The 'ls RCS' fails in case of filename=sample,vv in RCS/sample,vv,v
# ls RCS | cut -d',' -f1 | xargs co
# Use match to end of name $, as below -
if [ "$ans" = "Y" ]; then
ls RCS | sed -e's/,v$//g' | xargs co -l
else
ls RCS | sed -e's/,v$//g' | xargs co
fi
elif [ $# -eq 1 ]; then
if [ -f "RCS/$1,v" ]; then
# Here, in this case $1 will be like dbalter.sql
# and not like db*.sql....
#echo "One arg, no. of args = " $# " and all args " $@
if [ "$ans" = "Y" ]; then
co -l "$1"
else
co "$1"
fi
else
# For case where $1=db*.sql and there is no db*.sql in
# current directory
#echo "No files... no. of args = " $# " and all args " $@
tmpaa="RCS/$1,v" # will be like RCS/db*.sql,v
ls $tmpaa | \
while read ii
do
#echo "ii is : $ii"
if [ "$ans" = "Y" ]; then
co -l "$ii"
else
co "$ii"
fi
done
fi
else
for ii in $@
do
#echo "ii is : $ii,v"
if [ "$ans" = "Y" ]; then
co -l "$ii"
else
co "$ii"
fi
done
fi

###12.3 ciall.sh

#!/bin/ksh

# ciall.sh (Check in files shell script)
# ciall.sh - Check in all the files in current directory into RCS
# This script is very useful for checking in enmass large number
# of new files into RCS. Saves time by avoiding to type the
# 'description' for every file
# And for files already in RCS, it does regular check-in command


# To convert filenames to lower case filenames, use this
# technique - use 'tr', see 'man tr'
#ls * | \
#while read ii
#do
# jj=`echo $ii | tr [A-Z] [a-z] `
# echo "ii is : $ii"
# echo "jj is : $jj"
# mv $ii $jj
#done

if [ ! -d RCS ]; then
print "\nDirectory RCS does not exist!!"
print "\nWill be creating RCS directory now ...\n"
mkdir RCS
fi

print "\n\nNOTE: This is not log message!"
print "Please enter description (will be used for"
print -n "all the files checked in) : "
read description

# Option prune does not work, use -maxdepth 0
#find * -prune -type f |

# The number of args is zero or more....
if [ $# -eq 0 ]; then
listoffiles="*"
else
listoffiles="$@"
fi

# Option prune does not work, use -maxdepth 0
#find $listoffiles -prune -type f |
find $listoffiles -maxdepth 0 -type f |
while read ii
do
#echo $ii
if [ -f "RCS/$ii,v" ]; then
#print "The file $ii already in RCS"
ci -m"$description" $ii
else
#print "The file $ii is new file"
ci $ii << EOF
$description
EOF
fi
done
rcs  shellscripts  scripts  bash  versioncontrol  scm 
april 2013 by kme
Maniacally cuckoo for Mountain Lion: App Store checker shell script
In the spirit of Tim Cook's maniacal excitement about upcoming Apple products, I bring to you the shell script you can run repeatedly from the command line to check the App Store to see if Mountain Lion is ready for purchase.

This is what I used last year to check for Lion; it worked. This year, I update the search string to "Mountain Lion" instead.

As presented, it employs a 10-minute time-out, so you can run a repeat command with it.

#! /bin/csh
curl -silent -A "iMacAppStore/1.0.1 (Macintosh; U; Intel Mac OS X 10.6.7; en) AppleWebKit/533.20.25" 'http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewMultiRoom?fcId=489264329&mt=12' | grep -i "mountain lion" > /dev/null
if ($? == 0) then
echo "Available"
say "MOUNTAIN LION MAY BE AVAILABLE"
else
echo "Nada"
endif
sleep 600

Ready to improve the script? Have at it, campers!

Update: Looks like the URL changed from last year. Updated via Mark (mcackay).
Maniacally cuckoo for Mountain Lion: App Store checker shell script originally appeared on TUAW - The Unofficial Apple Weblog on Tue, 24 Jul 2012 18:40:00 EST. Please see our terms for use of feeds.
Source | Permalink | Email this | Comments
features  Getting_Ready_for_Mountain_Lion  GettingReadyForMountainLion  Hacksugar  Mac  Mac_App_Store  MacAppStore  mountain_lion  MountainLion  os_x  OsX  Scraping  Shell_Scripts  ShellScripts  Terminal  Utilities  from google
july 2012 by cardinale
Split and encrypt files for google docs
"Since January 2010, Google docs has allowed you to store any type of file, even arbitrary binary files. However, there are a couple of gotchas: one cannot upload files greater than 1GB in size, and you may want to encrypt your files so that not just anyone can read them (for instance server backup files).

The two bash scripts below provide a solution for the above."
googledocs  bash  shellscripts 
february 2012 by InvertedX

Copy this bookmark:





to read