Tagged Questions

Tcsh 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

0
votes
4answers
87 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
7 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
13 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
34 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
43 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
78 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
54 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
30 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
280 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
32 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
159 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
86 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
420 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
78 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
118 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
32 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
991 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
40 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
212 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
46 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
60 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
48 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 ...
1
vote
1answer
66 views

How to print a partial list of alias definitions in tcsh?

I'm working on Fedora 18 with tcsh on a network with a lot of pre-defined aliases. I'm adding my own personal aliases as well, but I want to be able to display these in a separate list. Right now I ...
1
vote
1answer
689 views

FreeBSD csh, TAB to show available choices?

I am a newbie to FreeBSD. How can i configure csh or tcsh to show available choices by pressing TAB twice, just like bash?
1
vote
1answer
57 views

Grep expression with special file names

I have to go through some regular files in directories and find those files, that have their own name in its content. In the following piece of script is a cycle in which I am going through paths ...
1
vote
2answers
180 views

Use of find in unix on strange file/directory names

Im a beginner scripter, writing scripts in tcsh and csh (these are taught in my course). I'm writing a script which uses find for putting path of directories this is the part of the script: set list ...
11
votes
4answers
848 views

Search for a previous command with the same prefix when I press Up at a shell prompt

Coming from a FreeBSD world I wish to make the Linux terminal behave like FreeBSD one, especially the 9.1 version, basically when you type cd in the terminal and push the "up" arrow you can browse all ...
3
votes
2answers
209 views

Which shell I am running on?

When I run echo $SHELL the output says /bin/tcsh which means that i am running tcsh. But for example when I issue the following command alias emacs 'emacs -nw' I get the following error: bash: ...
2
votes
1answer
40 views

How do I set a variable as the user id

I want to write a start up script in tsch that creates a directory some where named with the current user id. I was hoping the following would work. Set A = (id -u -n) But I'm not sure how to ...
2
votes
0answers
114 views

Preserve tcsh history in multiple terminal windows

How can we preserve or maintain the same history across multiple terminals? The same question, but for bash shell , were discussed in the below link Preserve bash history in multiple terminal ...
0
votes
1answer
130 views

How achieve variable indirection (refer to a variable whose name is stored in another variable) in tcsh

I'm trying to do the following: set a = kitten set temp_kitten = purr echo ${temp_$a} I want the echo command to return "purr". The overall idea is that I have a bunch of variables in an array and ...
1
vote
4answers
161 views

All subprocesses are Bash (!),

I was trying to use GDB, and found that whenever it attempted to spawn the program I was debugging, Bash was spawned instead (GDB would say starting myProg..., and then Bash would appear. When I ...
0
votes
1answer
213 views

In tcsh shell how I find a particular word in the command prompt?

Suppose I have the following line in my command prompt and the cursor is at the and of the line or the beginning of the line by using (CTRL+A) [subhrcho@slc04lyo pcbpel]$ abc def ghi jkl How can I ...
1
vote
1answer
327 views

How can I move between words in the command prompt in tcsh in linux?

I want a feature like vim's going forward or backwards command (w,e,ge,b) etc in the shell prompt. I am using tcsh shell in Linux. I would like to go 'n' number of words backs or forward etc and do ...
1
vote
2answers
50 views

Can I see in history output from which directory I had actually issued a command?

CTRL+R allows me to reverse search through the command history which is great but can I also find out from which directory that command was run? I am using C-shell in Linux.
3
votes
2answers
185 views

scp does not auto-complete in the same way as other commands

I am using tcsh. I found that when I do scp mytab, it doesn't autocomplete to my-file.txt under the current directory I have to prefix a ./ there to make it complete. This seems to only happen with ...
1
vote
2answers
471 views

Change the color of tcsh output for any command

I want a different color for terminal returns: Example: $ pwd //when return key is hit $ /home/user/tools //return value printed in different color, say: grey color This ...
1
vote
1answer
60 views

How to autocd in tcsh?

I want to change directory without using cd, I want to access the directory by its name $home/user/tools $cd tools //works fine $tools //permission denied I tried set autocd but still the same?
0
votes
1answer
99 views

Problem Aliasing a Command With a Pipeline and an Argument

Note: I use tcsh. I am trying make an alias that will use the mutt command to send an email with a pre-written body and subject line but that will take the alias argument and attach it to the email. ...
0
votes
0answers
19 views

C Shell Array Declaration Syntax, () vs. {} [duplicate]

In my C-shell script (tcsh specifically) I have been trying to declare an array with six values: x, nx, y, ny, z, nz. After some trial and error I discovered three different ways of declaring the ...
3
votes
2answers
4k views

C Shell Array Declaration Syntax, () vs {}

In my C-shell script (tcsh specifically) I have been trying to declare an array with six values: x, nx, y, ny, z, nz. After some trial and error I discovered three different ways of declaring the ...
0
votes
1answer
105 views

Why do some default bindkey keys do not work in tcsh?

I'm using tcsh and I'm seeing that some of my custom and some of the default bindkey bindings do not work. Why don't they work? For example: I load some default bindings: bindkey -e I check the ...
5
votes
2answers
220 views

awk + paste for cleaning up PATH?

I have seen this code in .cshrc init files on a few machines. I went through a few awk tutorials in trying to understand how it works, but I am still unable to decrypt it. setenv PATH `echo $PATH | ...
3
votes
1answer
58 views

Script not getting executed as per expectation

I have two Perl scripts at a predefined location in Unix. This predefined location is set in path variable ($PATH). Now when i try to run first script (from any location) the script runs successfully ...
5
votes
3answers
325 views

change prompt formatting based on cwd

I use tcsh. I'd like to have my prompt formatting (coloring/highlighting) change based on the directory I'm in, or other critical aspects of my environment. I'm not enough of a shell hacker to know ...
3
votes
6answers
418 views

How do I specify arguments to return all dot files, but not . and ..?

Normally dot files are not included for wildcard expansion: % echo * Applications Desktop Documents Downloads Library Movies Music Pictures Public bin If I explicitly ask for dot files, I get them: ...
1
vote
4answers
46 views

Ambiguously named executables

It appears that in tcsh if I have ambiguously named executables in two separate folders in the $PATH it directs to the one in the most recently created folder. Am I correct? And is this always true? ...
2
votes
3answers
643 views

tcsh shortcut to move the cursor back to previous space

I'm looking for a keyboard shortcut in tcsh to move the cursor back to the previous blank: not ESC+B which takes me back one word (for instance, in a path argument, to the previous path component) - I ...
0
votes
1answer
347 views

Why does my TCSH prompt change after cd?

My .cshrc file contains the following: set prompt = "%{\033[0;32m%}%S%B\! <%~> :%b%s %{\033[0m%}" Each time I cd out of my home directory, the prompt formatting resets to display: 33 ...
1
vote
2answers
186 views

Different shells for interactive and non-interactive work

Due to constraints at my workplace, the default shell for every user is tcsh, and I am required to use tcsh as my non-interactive shell (i.e. we do most of the environment configuration across ...