#!/bin/csh -f # skip_in_AllSigns # ------------------------------------------------------------------------- # Shell script to create .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 add .SKIP to end of specified filenames. cd ~/fred/website/bristle/Tips/DontBeATrump/TrumpProtestRallies/AllSigns if (`find . -maxdepth 1 -type l -name "*$1*" -print` != "") then foreach file (*$1*) if (-l "$file") then if ("$file:e" == "SKIP") then echo "Link already exists: $file" else mv -v "$file" "$file.SKIP" endif endif end # There are no links with $1 in their names. Do the single specified # SKIP file. Don't use wildcards. Don't want to refuse to create a SKIP # file because a similar one already exists. else if (-e "$1.SKIP") then echo "Already exists: $1.SKIP" else (set echo; touch "$1.SKIP") endif