Questions tagged [tcsh]

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).

Filter by
Sorted by
Tagged with
44
votes
5answers
40k views

Which shell am I running on?

When I run echo $SHELL the output says /bin/tcsh which means that I am running a tcsh shell. But for example when I issue the following command alias emacs 'emacs -nw' I get the following error: ...
21
votes
3answers
10k views

How do I temporarily bypass an alias in tcsh?

I am using tcsh. bash and zsh and other suggestions won't help here. I have several aliases that are named the same thing as another command, so if I did unalias it, typing the same thing would now ...
9
votes
2answers
10k 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 ...
18
votes
3answers
10k 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 "\e[5C":forward-...
4
votes
1answer
6k views

Operate on command output in tcsh

I think the correct operator for executing subshell command in tcsh is the backtick ` but when I attempt to do a diff on the results of two commands I get an error. When I direct the information to ...
3
votes
3answers
4k views

Error “syntax error near unexpected token `('?”

What's in my terminal bash: settings64.csh: line 35: syntax error near unexpected token `(' bash: settings64.csh: line 35: `foreach i ( $xlnxInstLocList )' Portion of the script set xlnxInstLocList=...
2
votes
4answers
13k 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 ...
3
votes
2answers
223 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 ...
3
votes
2answers
2k 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 { ...
3
votes
6answers
5k 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 ...
0
votes
1answer
3k views

'setenv' command not working on tcsh shell when called explicitly

I can run setenv command just fine in my tcsh shell like this: echo $0 /usr/bin/tcsh echo $SHELL /usr/bin/tcsh setenv START_TIME `date +%s` echo $START_TIME 1499355967 But, whenever I run it ...
0
votes
1answer
1k views

Setting up command promt in tcsh to show only last 3 working directory instead of complete path?

I have command prompt in tcsh that shows the current working directory. The problem is that the command prompt becomes very big once I am in a deep hierarchy of folders. How do I set the command ...
100
votes
7answers
192k 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: ...
33
votes
7answers
90k views

Which shell should I use - tcsh vs bash? [closed]

I have been using tcsh for a long time now. But whenever I am searching for something, I often find that the methods specified are bash specific. Even the syntax for the shell scripts is different for ...
25
votes
3answers
3k views

How does a shell know home(s)?

Each shell has an environment variable $HOME set (ex: /Users/lotolo). If I'm under csh I can unsetenv HOME and still if I do cd I'll be in my home. I've tested this also on bash (unset HOME) and it'...
8
votes
3answers
14k views

How do I create a directory for every file in a parent directory

I have parent folder and inside this folder I have 4 files ParentFolder File1.txt File2.txt File3.txt File4.txt I wanted to create subfolders inside the parent folder and ...
9
votes
2answers
7k 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 ...
8
votes
5answers
7k views

How to have separate command history for different sessions for the same user?

I face this issue on some of Unix servers. When I open different session for same user, command history is shared by all the session. This creates issues if by mistake I press Ctrl-P or up arrow and ...
6
votes
2answers
49k 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 ...
6
votes
3answers
14k 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 ...
5
votes
2answers
13k views

Source shell script automatically in terminal

How can I automatically source a particular shell script when I open a terminal window by right clicking somewhere and choosing "open in terminal"? For example, every time I open a terminal I need to ...
4
votes
1answer
3k views

How to redirect output to file to STDOUT?

Similar problem as here How to redirect output from file to stdout? However, the solution given there is not universal. My problem: I have a command that produces output to STDOUT. At the same time, ...
3
votes
1answer
840 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 ...
7
votes
3answers
202 views

'switch' based on shell

I would like to source (i.e. not call) a script from any shell (bash/csh are the primary targets, but fish, zsh, ksh, and rc would also be interesting). I would like if the script can be a single ...
4
votes
2answers
2k views

Autocompletion for Makefile rules in tcsh

I'm using tcsh in a SUSE 11 box and I realized that when typing makeTab it allows me to auto-complete the rules available within the Makefile, not the files that are inside the current directory. ...
3
votes
2answers
6k views

Setting up LS colors with a human-readable script in tcsh

I have a shell script (set_up_my_ls_colors.sh) that, if I call from my shell, it configures my color scheme for ls. The nice thing about the script is that it allows me to configure colors in a human-...
3
votes
1answer
2k 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 { ...
3
votes
1answer
2k views

tcsh preserve newlines in command substitution `…`

So, I wrote a simple script to convert sh-style export key=value statements to csh-style setenv key value for docker-machine env. #!/bin/sh docker-machine env | sed -e 's/export/setenv/' -e 's/=/ /' -...
4
votes
1answer
4k views

How to make my Linux tcsh prompt bold?

Greeting all, I am attempting to make my Linux tcsh prompt bold. However I'm failing miserably. I know about escape codes and I can successfully make echo'ed output bold, but I can't seem to do it ...
3
votes
1answer
636 views

Supress startup messages on stdout?

I'm using tcsh, and have to source a group .cshrc file. This file echoes some messages, which is fine for normal shells, but causes problems with programs like scp and rsync. I can see the solution ...
3
votes
1answer
640 views

How to properly use $_ inside a tcsh script sourced from another tcsh script?

I try to retrieve the result from $_ inside a tcsh script itself sourced by another tcsh script (I'll refer to them respectively as the inner and outer script). But $_ is not set with the value I ...
2
votes
0answers
372 views

How can I check which shell I am currently using? [duplicate]

Possible Duplicate: How to test what shell I am using in a terminal? An echo $SHELL will only display the value of the SHELL variable which would indicate the default shell on the system. But I ...
2
votes
1answer
2k 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 ...
2
votes
1answer
1k 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
2answers
346 views

Why does tcsh consistently have multiple fd's pointing to /dev/tty

This is on Ubuntu 16.04, with bash 4.3.42 and tcsh 6.19 If a open a virtual console not being used by X and run bash, I see stdin, stdout, stderr and a dedicated file descriptor for the tty (...
1
vote
1answer
105 views

How to understand which shell a particular code belongs to without knowledge about the shell?

I get to understand that this code is for bash shell for f in $file.docked.[0-9][0-9][0-9] do mv $f $f.pdb done And this code is for tcsh shell foreach f ( file.docked.[0-9][0-9][0-9] ) mv $f ...
0
votes
1answer
290 views

tcsh bindkey to turn on readline variable `visible-stats`

In .inputrc I store readline commands for bash, for example: bind "\C-S": i-search-fwd I do the same in .bindings for tcsh: bindkey "^S" i-search-fwd To specify readline variables in .inputrc I do:...
0
votes
2answers
244 views

Why 'kill -l' gives different output in fish and bash

I was using fish-shell when reading about kill command. The output of kill -l command for fish is HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM .... When invoking same command ...
0
votes
2answers
869 views

How to split and access fields delimited by colon?

This piece of code: foreach line (`cat /etc/group`) echo $line end returns line containing 4 fields delimited by :. How to split fields and access the first field of each line?