home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 509.lha / CShell_v5.13 / tips.doc < prev   
Text File  |  1991-05-06  |  3KB  |  112 lines

  1. Some good ideas:
  2.  
  3.  
  4.     EDITING
  5.  
  6.  
  7. The very common situation:
  8. $ mkdir documents
  9. $ cd documents
  10. can be abbreviated to:
  11. $ mk documents
  12. $ [CTRL-T]              (inserts all but first word of previous line)
  13.  
  14.  
  15. Also very common:
  16. $ mv document document1
  17. $ mv document[CTRL-P]1
  18. The CTRL-P function duplicates the previous word on the command line
  19.  
  20.  
  21. You  might  have  wondered  what  CTRL-N  (leave current line) is good for.
  22. Assume, for example, you just typed
  23. $ rm dh1:graphics/lo-res/gorilla
  24. when  it comes to your mind that would prefer to keep a copy of that pic on
  25. diskette.  Many would now delete this command line.  Being a smart guy, you
  26. do the following:
  27. $ [CTRL-N]              (leaves this command line alone)
  28. $ co[CTRL-T] df0:
  29. $ [Up-Arrow][Up-Arrow]  (gets back the command line you left)
  30.  
  31.  
  32. In case you don't know what history completion is:
  33. $ search *.c *.h makefile foobar
  34. $ ram:
  35. $ dir
  36. $ rm tmpfile
  37. Now if want to repeat the search command, enter
  38. $ se[Shift-Up-Arrow]
  39. which brings up the the last command that started with 'se'.
  40.  
  41.  
  42. If you want to delete the file
  43. $ rm dh2:comm/uucp/mail/junk/409
  44. and you're far away from that directory, enter
  45. $ ju[ESC-c]409          (enters the resulting path of cd ju)
  46.  
  47.  
  48. The  same function is also usable for 'cd'.  Assume you have several 'junk'
  49. directories:
  50. $ ju[ESC-c][CTRL-R][CTRL-R][CTRL-R]
  51. Like  this  you'll cycle through the junk directories.  When you've got the
  52. right one, press enter.
  53.  
  54.  
  55. Assume  there  are the files comm1.c, comm2.c, and comm3.c as well as their
  56. corresponding .o files.  You want comm3.c:
  57. $ co[Shift-Tab]1[Tab]
  58. Of course this is more useful with longer file names.
  59.  
  60.  
  61. You can tab file name expand any patterns, not only abbreviations.  Assume
  62. you want to delete all .c files in the current directory but the last:
  63. $ rm *.c[ESC-Tab][CTRL-W]
  64. In addition, you get to see all the files once again before deleting them.
  65.  
  66.  
  67. Next one: You have entered:
  68. $ dir
  69. $ foreach i ( *.c ) "e >>ram:temp $i
  70. $ more ram:temp
  71. and you would like to execute the same three statements again, enter:
  72. $ [Up-Arrow][Up-Arrow][Up-Arrow][ESC-Return][CTRL-R][CTRL-R]
  73.  
  74.  
  75. I  know  that  the editing is not very user friendly.  This is because it's
  76. quite  hard  and troublesome to get raw keycodes from the console, and it's
  77. impossible  to  get  them  from a VT200 terminal.  Therefore I had to stick
  78. with CTRL and ESC combinations. Once you have learnt them (some of them are
  79. similar to EMACS), you can save lots of typing.
  80.  
  81.  
  82.     COMMANDS
  83.  
  84.  
  85. My  advice  here  is clear:  Use aliases, aliases, aliases.  In order to be
  86. able  to  create  them as quickly as possible, create an alias (e.g.  'le')
  87. that edits your login file, plus another one (e.g.  'lx'), that re-executes
  88. it.   My  login  contains  almost  only aliases, everthing else I've put in
  89. 'firstlogin.sh'.
  90.  
  91.  
  92. If you don't like the default options of one command, you can add more of
  93. them using an alias:
  94. $ alias dir "dir -q
  95. From now on, blocks will no longer be displayed in 'dir'.
  96.  
  97.  
  98. If your aliases have arguments, e.g.
  99. $ alias sc "search *.c
  100. problems arise when you try to specify options. e.g. case sensitivity:
  101. $ sc -c "hello world
  102. this will obviously not work. That's what @pickopts is good for:
  103. $ alias sc "%a search @pickopts( $a ) *.c @pickargs( $a )
  104.  
  105.  
  106. Once you have more aliases, it is useful to keep them sorted.  You might
  107. also document them: Create a file 'aliases.doc', and perform
  108. $ set _man aliases.doc csh.doc
  109. That way, you can document them in a separate file.
  110.  
  111.  
  112.