Tcsh is a shell for Unix-like operating systems and an enhanced, but completely compatible version of the Berkeley UNIX C shell (csh).
5
votes
2answers
65 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
42 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 ...
1
vote
0answers
34 views
change prompt formatting based on cwd
I use tcsh. I'd like to have my prompt formatting (coloring/highlighting) change based on what directory I'm in.
Namely, if I'm in one of "my" directories (my username in the full directory path is a ...
3
votes
6answers
171 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
36 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
85 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 ...
1
vote
2answers
112 views
Difference between 2>&-, 2>/dev/null, |&, &>/dev/null and >/dev/null 2>&1
Just looking for the difference between
2>&-
2>/dev/null
|&
&>/dev/null
>/dev/null 2>&1
and their portability with non-Bourne shells like tcsh, mksh, etc.
0
votes
1answer
68 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
82 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 ...
1
vote
3answers
68 views
Multi-line PATH in tcsh
Inspired by the accepted answer to this thread, I am trying to replicate a similar construction in tcsh (version 6.14.00) with no luck:
setenv new_PATH (
/some/path
/some/other/path
# Some comments
...
1
vote
1answer
34 views
How rename directories tree entry by entry
I have text file contain two columns:
current directory name the new name of the last entry
d_7154/d_7161/ 'Main Integration'
...
3
votes
2answers
94 views
customise ls color for directories contain specified file/s
How can I colorize directories contain files with word INCORRECT inside?
Example:
I have 3 directories which contain log file.
dir_a/log
dir_b/log
dir_c/log
The file log in dir_c contain word ...
2
votes
1answer
213 views
tcsh alias - find FreeBSD port
I am trying to create an alias for tcsh. I would like to find a program in ports (FreeBSD ports).
So far I made an alias, which works, but finds only ports which end in *port_name. I would like it to ...
1
vote
1answer
82 views
How can one provide colour to tab completion in tcsh?
(Crossposted from StackOverflow.com)
This question and the answer teach us how to introduce colour into tcsh prompts.
This webpage explains nicely how to get colour into any output of the echo ...
3
votes
1answer
478 views
Global /etc/profile setenv or export overwriting user settings in .profile
I need to call a modified version of a program in /home/user_name/bin rather than the (older) version in /opt/program_name/current on a CentOS 5.3 cluster. The program creates a tcsh script using ...
1
vote
0answers
68 views
How to make tcsh not insert whitespace in a command that spans multiple lines
Bash does not seem to insert whitespace but tcsh does.
Tcsh
bash-3.2.25$ tcsh -c 'echo $tcsh; echo A\
> B'
6.14.00
A B
Bash
bash-3.2.25$ bash -c 'echo A\
> B'
AB
How can I ask tcsh to not insert ...
2
votes
2answers
576 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 ...
2
votes
0answers
110 views
Tcsh: Searching history using Ctrl-P and Ctrl-N
What are the equivalent functions in tcsh for the following zsh functions?
up-line-or-history
history-beginning-search-backward
down-line-or-history
history-beginning-search-forward
I have the ...
2
votes
0answers
138 views
assigning a multiline variable (tcsh prompt) to another
For tcsh, I have a prompt that is multiline:
set prompt = "%/\\
%n@%m[%h]% "
This shows the cwd on one line and then the user/host on second line. However, with this, I cannot make a copy of that:
...
4
votes
2answers
592 views
delete first line of file only if blank using sed
I have a solution for this in awk:
awk '{if (NR==1 && NF==0) next};1' somefile
but was unable to find one that worked in sed. E.g.,
sed -i.bak '/^$/{1,1d;}' somefile
ended up deleting ...
1
vote
5answers
179 views
bash equivalent of this use of tcsh “sched” command?
In tcsh, the built-in sched command causes a command to be executed by the current shell at a specified time.
I have the following $HOME/.sched file (this is a simplified version of it):
setenv ...
3
votes
1answer
145 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 ...
2
votes
1answer
315 views
bash readline: Key binding that executes an external command
(Background: I'm a long-time tcsh user, gradually transitioning to bash, and trying to find equivalents for some useful tcsh-specific features.)
In tcsh, I can define a key binding that executes an ...
3
votes
2answers
461 views
sourcing a file inside a script
I'd like to source a file inside a tcsh script. In code:
#!/bin/tcsh
unsetenv LD_LIBRARY_PATH
source $1
echo $LD_LIBRARY_PATH > temp_file
The expected result: The environment variable set ...
2
votes
2answers
400 views
How can I make the backspace key delete one character backwards in tcsh?
I have a clean installation of openSuse. This automatically sets up bash as the default shell.
For historic reasons, all of the aliases and shortcuts I want to port from an old computer are in tcsh, ...
0
votes
3answers
333 views
Storing commands in files
I'm trying to store commands in a file, so I can just easily call the file usnig the below bit of code;
./test
I need to run this bit of code;
Set n=0 ; foreach sql ( *_*.sql)
foreach? sed ...
1
vote
1answer
683 views
Running a full foreach command
I'm trying to run a foreach loop within just 1 line of code instead of typing each indivdual command like below;
Set n=0 ; foreach txt ( *_*.txt)
foreach? sed “s/_/-/g” $txt
foreach? @ n ++
foreach? ...
2
votes
3answers
125 views
Finding a number of occurrences of a certain character in tcsh
I am trying to find the number of certain types of files that have a '_' in the filename.
I'm a massive beginner so my syntax looks like this at the moment;
foreach txt ( 'ls *.txt')
set n=0
if(grep ...
1
vote
1answer
378 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.
...
2
votes
1answer
297 views
What's wrong with this csh file?
I don't have any experience writing .sh files. I want to run the pvm2raw utility of this app from the Volume Library.
I get the following error when running build.sh in Ubuntu 10.10.
build.sh is ...
4
votes
2answers
546 views
the usage of < /dev/null & in the command line
I tried to run an example java program using the following command line. However, I do not know what is the trailing part < /dev/null & used for?
java -cp /home/weka.jar ...
2
votes
1answer
837 views
Why my $PATH is not inherited by the invoked bash?
I work on an AIX system where I have no administrator privileges. It has several shells installed, default being tcsh. I am not allowed to change the login shell. Usually I start my session from exec ...
3
votes
0answers
417 views
How do I prevent ssh remote login from breaking dbus?
I'm running openSUSE 11.3 on my workstation at work under KDE, I don't have root access to it. The default shell has been set to tcsh. When I am logged in at my workstation and log in remotely from my ...
2
votes
1answer
409 views
What does the syntax of these echo commands mean?
I tried to use a copied script, which includes the following command
echo "rc $2" > $WORKDIR/out.dat
I can guess it tries to output some contents to file out.dat. But what does rc $2 mean?
It ...
5
votes
3answers
230 views
For a same unix or linux user, different sets of environment variables
I'm using tcsh, and for a specific project every member of my team connects to a server with the same user. (This is something we cannot change).
The situation arises because I want to have some ...
1
vote
1answer
261 views
When do environment variables get set in tcsh?
I set a lot of environment variables in my .tcshrc file, using the setenv command.
When I needed to have one of these unset today, I moved this file and opened a new terminal (this is all in a Gnome ...
2
votes
1answer
754 views
How do I set an unlimited size to the history file for tcsh?
This is a follow-up question to Is there a maximum size to the bash history file?.
Unfortunately, it doesn't work with the atmospheric science department computers, as they use tcsh rather than ...
3
votes
2answers
520 views
Tab autocompletion and history in tcsh
I use tcsh, and I'd like to set up the following behaviour, which I've seen on some systems in the past. If I type
!string TAB
then:
If the history contains a unique entry beginning with string, ...
1
vote
2answers
105 views
In tcsh how can I prepend 'cd ' to the output of a pipe?
As in, say I execute pwd to return the current directory and want to dump this in a script file so that I can come back, but I then need to prefix it with 'cd '?
1
vote
1answer
93 views
Printing evaluated prompt placeholders to screen
Is there a way to print interpreted PS1 variable placeholders to console? Something like
$ echo `%u`
for printing a username or
$ echo `%h`
for printing a host. I do know about environment ...
2
votes
3answers
878 views
How to exclude some commands from being stored in TCSH history?
I store my commandline history in TCSH, but I want to prevent certain frequent, simple commands like "exit", "cd" to be included in the history (the history holds only a fixed number of commands, so I ...
4
votes
1answer
470 views
Trouble adding date to tcsh history
I'm trying to add the date to my tcsh history information and I can't seem to figure out how to make it work. The tcsh man page reads like this for the history setting:
The first word indicates ...
1
vote
1answer
153 views
Making tcsh history isearch case-insensitive
How do I make tcsh's history isearch (ctrl-r) case insensitive? I
tried "set complete=igncase" but that affects file completion, not
history isearch.
4
votes
2answers
1k 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 ...
3
votes
1answer
280 views
Changing group and retaining environment variables
On campus, everyone's primary group is user and each person is additionally associated to groups depending on the courses he or she is taking, lab he or she works at, etc.
My coworker and I are ...
2
votes
1answer
734 views
Attempting to update Amazon Route53 using a script, but domain is not being updated
I have several Amazon EC2 instances, running Ubuntu 10.04, with which I'd like to use Amazon's Route53. I setup a script as described in Shlomo Swidler's article, but I'm still missing something.
...
4
votes
1answer
693 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 ...
4
votes
1answer
668 views
When auto-completing in tcsh, can I reference a previous argument?
I'm trying to get some efficient auto-completing going here, and have hit upon a bit of a snag.
I've got a command for setting two things at once. The first is a relatively small list, but the ...
3
votes
1answer
785 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 ...
2
votes
0answers
296 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.
...