.foo, bar, aaa.c, bbb.c, aaa.o, v1-xxx.c, v1-xxx.txt
*.c | matches aaa.c bbb.c v1-xxx.c |
v1-*.c | matches v1-xxx.c |
v?-xxx.c | matches v1-xxx.c |
* | matches all the files but .foo |
*.* | matches all the files but .foo & bar |
*.? | matches aaa.c bbb.c aaa.o v1-xxx.c |
*/*.c */*/*.cThere is no shell notation to match filenames in subdirectories at arbitrary depths. (The find command provides this capability.)
hey Unix, got a light?]
make >& make.messages &When you type a command like that, you receive a prompt for a new command almost immediately. The shell has created the background job, and then comes back to accept the next command. The interactive dialogue looks something like this:
% make >& make.messages & [1] Running make >& make.messages %The number 1 in square brackets is a job number. You can use this number in later commands.
% grep '#include' *.c > inclist & [2] Running grep '#include' *.c > inclist %
% cc -c giganticFile.c ^Z [1] Stopped cc -c giganticFile.c %
[2] Stopped (tty output) grep '#include' *.c > inclist
fgHowever, if there are two or more stopped or background jobs, you should specify which job you want to bring into the foreground. There are two notations. One uses the job number. E.g.
fg %2brings job number 2 into the foreground as it executes. The second notation uses the command name. E.g.
fg %makebrings the make command into the forgraound.
% bg %1 [1] Running make >& make.messages %
jobsThe output shows the job number, the status of the job, and the command that created the job.
alias copy cp alias quit exit alias rm rm -iSubsequently, you may use the name copy as a synonym for cp.
alias foo bar alias bar fooyou will get a polite error message when you type foo or bar as a command.]
unalias rmwould remove our alias for rm, above.
# My fpr program fmt myfile | lpr -Paixlw
csh fpr
chmod +x fpr ## this need be done once only fpr
echo $pathand that you can add an additional directory to your directory by executing a command like:
set path = (~/bin $path)where ~/bin is the new directory. [It is conventional to have a directory named bin in your home directory to hold any new commands that you want to create.]
fpr myfile1to format and print the contents of myfile1.
# fmt $argv[1] | lpr -Paixlw
set F = aaa.cassigns the the string of characters aaa.c to variable F, and subsequently we can access the string stored in F by writing $F. E.g.
cc -c $Fwould issue the command to compile file aaa.c.
foreach F (*) mv $F old-$F endYou may type this command interactively. (When the csh shell sees the foreach command, it keeps reading input until the matching end command is typed; then it sets variable F to each filename in the current directory in turn, executing the loop body for each such value.)
man cshor from books. As noted above, though, much of the usefulness of csh has been superceded by perl.