home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 530b.lha / CSH_v5.15 / sample.sh < prev    next >
Encoding:
Text File  |  1991-07-03  |  2.1 KB  |  84 lines

  1. # first a few useful aliases for dir
  2. al d   "*a dir @pickopts( $a ) -ze \"%6s %-.12n%m\" @pickargs( $a )
  3. al lst "*a ls -t $a"    # sorts by access time
  4. al lsl "*a ls -l $a"    # sorts by length
  5. al move "cp -m
  6.  
  7. # sc searches *.c, even 'sc -c main()' works
  8. al sc "%a search @pickopts( $a ) *.c @pickargs( $a )
  9.  
  10. # edf edits a function in CygnusEd if the name starts in the first column:
  11. al edf {
  12. %func 
  13.  set b ""
  14.  search -afl *.c $func | inp b
  15.  if $b
  16.   split b file line
  17.   lced $file
  18.   waitforport rexx_ced
  19.   inc line 1
  20.   rxsend rexx_ced "jump to file "$file "jumpto "$line" 0"
  21.  else
  22.   echo Not found
  23.  endif
  24. }
  25.  
  26. # this aliases suppress wild card expansion for certain commands
  27. al zoo     "*a Zoo $a
  28. al lharc   "*a Lharc $a
  29. al lz      "*a Lz $a
  30. al newlist "*a Newlist $a
  31. al eval    "*a Eval $a
  32.  
  33.  
  34. # this one will show all pictures, the newest first
  35. al newpix  "ls -nt | forline i STDIN \"ShowIFF $i
  36.  
  37. # if you want to run cshell internal commands in the backrund, use rs
  38. al rs      "rback csh -c
  39.  
  40. # some aliases for UNIX compatibility
  41.  
  42. # this ceates a chmod command that expects the bits first and the files after
  43. alias chmod "%a protect @subwords( $a 2 9999 ) @first( $a )
  44.  
  45. # the same with grep:
  46. alias grep "%a search @subwords( $a 2 9999 ) @first( $a )
  47.  
  48. set stk ""
  49. # pushd pushes the current directory on a stack
  50. al pushd "%a set stk $_cwd @subwords( $stk 1 10 );\\cd $a;e $stk
  51.  
  52. # popd  retrieves it from there
  53. al popd  "\\cd @first( $stk );set stk @subwords( $stk 2 10 );e $stk
  54.  
  55.  
  56. return 0
  57. # ------ CUT HERE ---- MANSPLIT.SH ----
  58. # this splits up csh:csh.doc in many little files, one per entry, which
  59. # should be usable for MRman or similar tools
  60.  
  61. echo Patience...
  62. set dest ram:cshdoc/           # set your destination directory here
  63. if -nd ram:cshdoc;mkdir ram:cshdoc;endif   # ...and here
  64. set mode skip
  65. forline i csh:csh.doc {
  66.  if $mode = write
  67.   if @strleft( $i^a 1 ) < " " 
  68.    echo >>$dest$file $i
  69.   else
  70.    set mode skip
  71.   endif
  72.  endif
  73.  if $mode = skip
  74.   if "    " = @strleft( $i 4 )
  75.    set mode write
  76.    set a @index( $i "(" )
  77.    if $a > 0;dec a 1;strleft i $i $a;endif
  78.    set file $i
  79.    echo >$dest$file $i
  80.    echo $file
  81.   endif
  82.  endif
  83. }
  84.