tcsh

Tcsh and/or bash directory completion with variable hidden root prefix

I'm trying to set up directory completion in tcsh and/or bash (both are used at my site) with a slight twist: for a particular command "foo", I'd like to have completion use a custom function to match the first /-delimited term to an actual subtree node, and then follow normal directory completion for any successive terms. It is sort of...

csh list of commands like ksh { list; }

Hi, In bourne-compatible shells, the { list; } syntax causes the complete list of commands to be read by the shell before executing it, without opening a new shell. Is there anything similar for the csh? Thanks. ...

How to use for loops in command prompt in csh shell -- looking for decent one liners

coming from bash shell, I missed on an easy rolling of loops (for i in (...); do ... done;) Would you post typical one-liners of loops in cshell? ONE LINERS PLEASE, and not multiple-lines thx ...

How do I launch an editor from a shell script?

I would like my tcsh script to launch an editor (e.g., vi, emacs): #!/bin/tcsh vi my_file This starts up vi with my_file but first displays a warning "Vim: Warning: Output is not to a terminal" and my keystrokes don't appear on the screen. After I kill vi, my terminal window is messed up (no newlines), requiring a "reset". I tried "...

second previous command execution

hello in unix command line !! will execute th eprevious command on the command line like below indibm202 21: date Tue Nov 10 17:38:13 IST 2009 indibm202 22: !! date Tue Nov 10 17:38:16 IST 2009 indibm202 23: what is the command to execute the second previous command? ...

How to map Delete and End keys on tcsh shell ?

I use tcsh , and when Delete/End is pressed on cmd line, it simply shows up as ~ ; I have to press <Ctrl><e> to go to end of line. Can anyone help me to be able to use Delete/End keys as their name suggests ? ...

How to backup tcsh history periodically to a single file in chronological manner ?

I use tcsh at work - one of the features I use extensively is command-line history completion at the shell prompt. Currently, I've limited the size of my history file to 2000 (as I don't want to slow down the shell too much). However at times I need a command I know I've used a month or two back , but by now has been erased. So I want a ...

Finding and opening a file with vim in a single command alias in tcsh

I want to make an alias which would work like this: vf hello.c would execute a find command to search for hello.c and open it in the vim editor. What is the best way to do it? I've tried the following (doesn't work): alias vf "find -name $* -exec vi {} \;" alias vf "vi `find -name $*`" Can anyone help ? ...

Weird Thing Happens in a Simple CShell Program

Hey fellas, I have this weird bug, and I have no clue how to fix it, would be very glad if you could help. #!/bin/tcsh -f set date = ${1} set time = ${2} echo 1 set month = `echo $date | cut -f1 -d"-"` set day = `echo $date | cut -f2 -d"-"` set year = `echo $date | cut -f3 -d"-"` echo $date $month $day $year echo $date $time if ($year >...

open last modified file in the directory using vi

I want a quick way to open the last modified file in the directory, perhaps in a form of alias. Currently, I do ls -ltr. Then copy-and-paste the filename Assume that I am using tcsh ...

How do I bind 'jk' to Esc key in Vi-Mode in tcsh shell

I love and use vim daily on tcsh. I love everything about vim. And one of the reasons why I love it so much is I dont have to lift my hands to do stuff. I have jk mapped to Esc key in vim. But unfortunately, I cant get the same thing on tcsh shell. Can someone help me bindkey jk to Esc on tcsh ? Also please guide me to tcsh and vi-mode...

How can I find the location of the tcsh shell script I'm executing?

Say I put an executable tcsh file in /path/to/my_script.csh and my current directory is anywhere, for example I'm in /path So I type to/my_script.csh I want to have a line in my_script.csh that will return "/path/to/my_script.csh" - like ruby's __FILE__ ...

Generate a random filename in unix shell

Hello, I would like to generate a random filename in unix shell (say tcshell). The filename should consist of random 32 hex letters, e.g.: c7fdfc8f409c548a10a0a89a791417c5 (to which I will add whatever is neccesary). The point is being able to do it only in shell without resorting to a program. ...

Passing partial arguments in tcshell

Hey, I'm writing a shell script (tcsh) that is supposed to received 3 parameters or more. The first 3 are to be passed to a program, and the rest are supposed to be passed to another program. All in all the script should look something like: ./first_program $1 $2 $3 ./second program [fourth or more] The problem is that I don't know ...

delete multi-line block of text with internal flag in povray file

I have a pov-ray file, which defines a lot of cylinders and spheres. Sometimes these shapes are defined to have "color@", which makes the povray unrenderable. One solution I've found is to delete the offending cylinders and spheres. So a file that contains this text cylinder { < -0.17623, 0.24511, -0.27947>, < -0.15220, ...

scripts on Cshell

hello, I've got some problem, I have list of data in the file: 053-37878 03828008 Moskovitch James 500 052-34363 01234567 Mendelson Kippi 450 053-32322 03828008 Jameson Shula 350 054-39238 03333333 Merden Moshe 300 is it possible rewrite this list in the same file (without using temporary file) but without last number thanks in advanc...

Error in csh script

I'm working with C-Shell, I'm trying to run this script set callsTo = "`cut -d" " -f2 ${1}`" echo $callsTo cut receives data from the file which is the first parameter: > ./myscript data I need only second field from every row: -f2. After that I want to check if the data was stored, but I receive or an error unmatched . or empty r...

errors on shell

somebody knows what does this error mean? Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]. I receive this error after I enter in my script this row #! /bin/tcsh -f ...

how to read rows?

I'm trying to read first row from the file > source ./rank file using this script set line = ($<) <- inside rank but when I enter echo $line I receive nothing, how can I change it? thanks in advance ...

unknown error in shell

can somebody explain me what does this error mean: > ./rank lines.in 'nknown option: `- Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]. this is my script rank: #! /bin/tcsh -f set line = `cat ${1}` echo $line I think that the problem I have is with first row #! /bin/tcsh -f I'm working on Windows! but after I wrote script on ...