22.10 cx, cw, c-w: Quick File Permission ChangesHere's a short script that I use a lot. To make a new shell script executable, for example, I type:
% Using cw adds write permission; c-w takes it away. This is the single script file for all three commands:
#! /bin/sh case "$0" in *cx) chmod +x "$@" ;; *cw) chmod +w "$@" ;; *c-w) chmod -w "$@" ;; *) echo "$0: Help! Shouldn't get here!" 1>&2; exit 1 ;; esac The script has three links. Put it in a file named cx . Then type:
%
The script tests the name it was called with, in - |
|