tcsh (TENEX C shell) is a shell for Unix-like operating systems and an enhanced, but completely compatible version of the Berkeley UNIX C shell (csh).

learn more… | top users | synonyms

2
votes
2answers
58 views

Reliably identifying the path to the directory containing the running script

There are plenty of answers in SO to address this question: Can a Bash script tell what directory it's stored in? Unix shell script to find out which directory the script resides? And there are a ...
3
votes
2answers
142 views

Inconsistency of stderr redirection between tcsh and other shells

I'm running into issues with redirection in tcsh. Consider the following commands: vi --version and vi --xxx. And let's assume this is on a machine where vi supports the --version option. The ...
3
votes
3answers
56 views

How to check if string is blank in tcsh

How can I check whether a string is empty in tcsh? Before you freak out, no I'm not writing shell scripts with tcsh. I am asking because I want to use this in my .tcshrc file. Specifically, I want ...
1
vote
2answers
28 views

tcsh: make 2-digit hours in prompt

I am attempting to simply get a standard lexigraphical time display in the prompt and the history file in the range of 00:00:00 to 23:59:59. I've tried set prompt=%P$ but this just produces, for ...
1
vote
0answers
81 views

launching fish shell to new terminal of tcsh on centos

I have downloaded fish shell on my centos, but when I switch command to /bin/fish or even try to run xterm -e /bin/fish I am getting following error: Standard input: echo $_ " "; __fish_pwd ...
0
votes
5answers
121 views

sed to replace with backspace

I have trail.txt, which contains spice netlist. Now I want to replace all expanded parameters to one line only i.e. remove + and append that line to previous line. trail.txt data + net06706 ...
1
vote
1answer
59 views

setenv from awk in tcsh

I am trying to set environment variables one per line from awk: $ <source command> awk '/inst/ { n = split($0,a,"/"); cmd = "setenv " a[n-1] "_ver" $0; system(cmd) }' However the out I get is ...
0
votes
1answer
58 views

What does dollar underscore mean in tcsh? $_

In a script I'm debugging, I see it use $_ at the beginning of the file. It appears to suck in the full command that called the file. When trying to wrap this script in another script though, the $_ ...
3
votes
6answers
233 views

redirect output to specific line number

I want to grep certain lines by keyword and redirect the output to specific line number of an existing file. Command grep "key" temp_file >> desired.txt What I need is that I can append the ...
-1
votes
1answer
28 views

csh: Get rid of job+PID when forking

With bash I can run: $ ssh bashuser@localhost '( ls -d / nosuchfile ) & echo foo; wait' foo ls: cannot access nosuchfile: No such file or directory / If I try the same with csh I get: $ ssh ...
4
votes
2answers
110 views

status check for sleep command

I have run sleep command in background as follow , How can I know the status of execution ..? Command sleep 2d ; find /home/disk1/ -exec touch {} \; & How can I know that its executed for 1 ...
3
votes
2answers
111 views

Compatibility scripting: Save $? for use later

I would like to write a small part of a script that saves the error status, executes some other code, and sets the error status to the original error status. In Bash it looks like this: << some ...
0
votes
0answers
15 views

PBS limiting the number of process on a node

I am trying to run a program on cluster. The program can distribute each of the calculation with an corresponding parameter, say k1, k2,...k4, to run on one core. I want to use 4 nodes with 1 ...
100
votes
7answers
12k views

How to kill a runaway cat?

Many times I accidentally run the cat command on files that have contents up to few thousand lines. I try to kill the cat command with Ctrl+ C or Ctrl+Z, but both only take effect after the total ...
0
votes
1answer
63 views

TCSH Prompt Displays Syntax Error Regarding Missing Bracket

I have set the prompt on my machine using the following code: set prompt = " %B%{\033[34m%}`hostname`: %c %D/%w %p :) %b" It outputs my preferred customized display . It looks like : However ...
8
votes
5answers
3k views

Convert file contents to lower case

I have temp file with some lower-case and upper-case contents. Input Contents of my temp file: hi Jigar GANDHI jiga I want to convert all upper to lower. Command I tried the following command: ...
0
votes
2answers
50 views

how to get list of shortcuts

I am currently using Esc + p to know my previous command run on terminal. similarly there is one like Esc+ Backspace to delete only certain character. I want to know more of such short-cut combos. ...
0
votes
2answers
60 views

append time to log filenames

I want to make log_files named as log_Jan_01_hh:mm:ss, so the variable time-stamp is defined as date +"%b_%d_%T". Now if I set the value to a variable: setenv now `date +"%b_%d_%T"` Then $now ...
2
votes
2answers
49 views

find and delete gives false status

I tried to execute delete as per many previous discussions occurred find & delete however my attempts lead to different experience. find . -type d -name "koko" -exec rm -rf {} \; deletes the ...
3
votes
1answer
295 views

Replace certain text occurred within curly brackets

I have sample file as follow : WEA { Direction = Input Tag = WriteEnable PortId = "A" } MEA { Direction = Input Tag = MemoryEnable PortId = "A" } CLKA { ...
2
votes
2answers
144 views

Event not found in sed call in csh script

I tried the code as given on delete text between curly brackets however I am facing this different error regarding event in sed. file contains: This is { {the multiline text} file } that wants { ...
2
votes
2answers
72 views

How to search empty alternation with tcsh

I want to search some empty alternation with ls but nothing is working. I have a list of files: foo.txt foouubar.txt fooubbar.txt fooubar_1.txt foounix.txt I want to have only foo.txt and ...
1
vote
0answers
101 views

Add entries to an array inside a loop

I am trying to update an array in a linux tcsh script. The script uses a while loop, and I want to add elements to the array every time the loop iterates. Is there a better way to do this? ...
2
votes
0answers
23 views

Escaping output in tcsh completion by program

How do I escape output in the program providing completion? Suppose: tcsh% complete foo 'p/*/`mycomp`/' And mycomp is a Perl program printing this: #!/usr/bin/perl print "one\n"; print "two ...
2
votes
1answer
35 views

tcsh completion questions

I come from bash and am looking into tcsh's tab completion feature. 1) Is it correct that tcsh cannot delegate completion to a shell function (the way bash does with 'complete -F _func cmd')? 2) ...
3
votes
0answers
77 views

parametric aliases in csh to add export command

I'm trying to find a way to translate functions to csh/tcsh aliases, since they lack functions but have parametric aliases. As a first step I'm trying to create an export command. Here's what I've ...
0
votes
1answer
32 views

tcsh alias for cd through path of a port after searching

Now I try to create an alias for this command: alias cdport 'cd `whereis \!^ | awk \'{print $2}\'`' Can't find any good examples of using more than 2 commands in a sequence. How to fix that ...
0
votes
1answer
24 views

tcsh: sequence command

How to change dir from output of previous 2 cmd ? In bash it would be something like: cd $(whereis evince | awk '{print $2}') I need this in tcsh Just can't find examples. Reading man wasn't ...
1
vote
5answers
151 views

Create a list of directories

I have a list of names in a text file (list.txt) I want to create a list of folders for the names included in that file. I wrote the following script, but it doesn't work and I don't know what is ...
1
vote
0answers
20 views

tcsh: i-search-back character glitch

As seen in a few other answers, I added this to my .cshrc to make CTRL-R behave similar to bash: bindkey "^r" i-search-back It works fine in general. My problem is that when doing CTRL-R followed ...
0
votes
0answers
52 views

Unicode emoji not showing up in tcsh prompt

I set my prompt on tcsh 6.18.01 to use some silly emoji characters, but they don't show up. > cat .cshrc set prompt = '\n🔥 [%~]\n%# ' \360\237\224\245 [~] ...
0
votes
2answers
129 views

How to printf an exclamation point in tcsh?

What's the best way to printf an exclamation point in tcsh? It seems like using single or double quotes has no effect on escaping the exclamation point; and using a backspace does work, but then it ...
2
votes
1answer
290 views

Can you change timestamp format for history command on tcsh

When I run history command (on tcsh), it only prints the TIME portion of the timestamp and omits the date: 3 15:07 echo $PATH 4 15:07 ls -la In bash, you can use HISTTIMEFORMAT ...
1
vote
1answer
140 views

calling script from perl/python/ruby and retrieving output [closed]

I inherited a tcsh "master" script that works and extracts lines from files with data with using 'zcat' piped to 'grep' and some other commands/scripts. The extracted lines contain numbers . It is ...
0
votes
2answers
276 views

~./inputrc file not sourcing correctly

I have this ~/.inputrc file that I created for certain key bindings. # mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving "\e[1;5C":forward-word "\e[1;5D":backward-word ...
0
votes
0answers
51 views

A script to identify whether a file descriptor has gone bad

Problem : I have a server program running which connects to a remote program using TCP sockets. There many of them (say 20). My problem is one of the socket descriptor has gone bad and has recieved ...
2
votes
1answer
1k views

setenv not working in tcsh

I am trying to install a program on my brand-new CentOs. The installation requires setenv, which apparently does not work, not even in the tcsh shell. Can anyone give me some advice? [Anna@anna ...
0
votes
0answers
35 views

Parameters files, pfiles director: how to overwrite default settings

This is a quite general question that I am not sure to be able to address correctly. I must manage some bash or tcsh scripts that invoke other software's tools. These tools are invoked by name and ...
0
votes
2answers
233 views

Simple Script to setenv tcsh or export bash

I am having problems with simple scripting, my Box is CentOS so bash is the default shell, now I wanted to send a line via setenv (tcsh) and would like to make a script that will ask me to input a ...
1
vote
1answer
157 views

tcsh/vi-mode behavior difference between Solaris and Linux

We have both Solaris and Linux environments at work. We use tcsh as the standard shell for hundreds of users. My question is about vi-mode in tcsh: In Solaris, while I'm typing, I can backspace ...
2
votes
1answer
1k views

syntax error: unexpected end of file

#!/bin/csh -f set no=1460 while ("$no">0) if [$no>900]; then set m=3 else if ["$no">450 && "$no"<901]; then set m=2 else set m=1 fi mv *$no.bin test/abc-$m-$no.bin set no ...
2
votes
2answers
130 views

How do I run a command on each input given a list of input

I have a bunch of folders, and I want to cd into each folder and run a command. I feel like it should be something like this: (The following is a contrived and simplified example of what I want to ...
1
vote
1answer
332 views

What causes a csh script to sometimes not source /etc/csh.cshrc?

I have a csh post-installation script that is executed from an rpm %post with its interpreter line set to #!/bin/csh (without the -f option). This should cause the file /etc/csh.cshrc to be read ...
1
vote
1answer
38 views

Need to set a variable with “[]”

I have a tcsh script, in which I need to set a variable to this value defining my system type. type=abc project=def sysname=["Linux"] I tried various combinations to escape the [ and " but have ...
2
votes
1answer
2k views

Changing text color in c-shell

I can change the text color in the terminal permanently by adding this: export PS1="\e[0;31m[\u@\h \W]\$ \e[m" to the .bashrc file. Now I have to go into cshell, what is the corresponding way?
0
votes
1answer
49 views

mailx change the direction of the mail

I use mailx to send mails from servers to me. The problem is that it comes as RTL and not LTR. How can I define it in the command? here is the command: cat /tmp/monitor.log | mailx -s "Daily status ...
1
vote
2answers
459 views

How to execute a builtin shell command using find?

I'm constrained to doing this in tcsh on CentOS due to the environment at work. When executing find . -type f -executable -exec source '{}' \; the only result is find: 'source': No such file or ...
0
votes
1answer
76 views

TCSH bitwise | operator

How do I use the bitwise logical-or operator, |, in tcsh? I enter @ y = 1001; @ z = 0110; @ x = $y|$z 110: Command not found.
0
votes
1answer
72 views

How to print whole array in tcsh

I want to print the whole array in tcsh, because then i want to pipe it to uniq, is there a way to do it in tcsh. i had set array and was printing it: echo "$array" but it ended up with error: ...
1
vote
0answers
106 views

Properly defining a multi-line prompt in tcsh

I am trying to configure my prompt in tcsh to make it multi-line (i.e having one line provide system info, and the next line the one where I type commands). Currently I have the following: set ...