#!/bin/csh -f # Can't do this because sudo can't run pushd (shell built-in command) # Instead, have to do it on one line and leave current directory unchanged. #sudo pushd /var/log/httpd #sudo dir access* # Have to call a secondary script to get it to do the wildcard expansion # after the sudo command has given it access # Can't call it as: # sudo $0:h/acclogs2 # because this script is typically run via "source", so $0 is "-tcsh", # not the name of the script. Have to hardcode the path for now. sudo ~fred/fred/bin/acclogs2 # Note: These alternative techniques did not work: # - Escaping the wildcard w/backslash doesn't work. Never expanded. # sudo dir /var/log/httpd/access\* # - Setting noglob doesn't work. Never expanded # (set noglob; sudo dir /var/log/httpd/access*) # - Using quotes doesn't work. Treats the whole string as a command verb # sudo "dir /var/log/httpd/access*" # - Using quotes doesn't work. Never expanded # sudo dir "/var/log/httpd/access*"