#!/bin/csh -f # skip_in_AllSigns # ------------------------------------------------------------------------- # Shell script to delete .SKIP flags in the folder # ~/fred/website/bristle/Tips/DontBeATrump/TrumpProtestRallies/AllSigns # for specified files. # ------------------------------------------------------------------------- # Revision History: # $Log$ # ------------------------------------------------------------------------- # Collect command line options while ($#argv > 0) if ("$1" == "-h" || "$1" == "--help") then echo "Usage: $0:t [options] full_or_partial_filename..." echo "Options:" echo " -h = Show this help text" echo " --help = Show this help text" exit 1 else if ("-" == "`echo $1:q | cut -c 1`") then echo "Error: Invalid option: $1:q" $0 --help exit 1 else # Not a recognized option. Assume it's the first argument break endif end # Collect command line arguments if ($#argv < 1) then echo "Error: At least 1 argument required" $0 --help exit 1 endif # Move to the links folder and remove .SKIP from end of specified filenames. cd ~/fred/website/bristle/Tips/DontBeATrump/TrumpProtestRallies/AllSigns if (`find . -maxdepth 1 -type l -name "*$1*.SKIP" -print` != "") then foreach file (*$1*.SKIP) if (-l "$file") then mv -v "$file" "$file:r" endif end # There are no links with $1 in their names and ending in .SKIP else if (`find . -maxdepth 1 -name "*$1*.SKIP" -print` != "") then # There are non-link files with $1 in their names and ending in .SKIP (set echo; rmempty *$1*.SKIP) else # There are no files with $1 in their names and ending in .SKIP echo "Doesn't exist: *$1*.SKIP" endif