tcsh is a Unix command shell based on the C shell (csh)

learn more… | top users | synonyms

0
votes
2answers
6k views

Running commands as another user on their machine via ssh?

As part of my normal workflow I ssh into another user's machine, switch user to them, run a command, then exit out to my own machine again: ssh hostname sudo su user runcommand exit exit Is there a ...
0
votes
1answer
24 views

How do I insert the results of a unix command into the tcsh CLI?

I often find myself wanting to create datestamped files and folders. For example, I'd love to be able to create a folder with a yymmdd datestamp called "160408-projectA" by typing: mkdir <ctrl-;&...
7
votes
1answer
5k views

Can I “export” an alias to the SHELL that invoked a script?

I'm trying to write a utility script that defines certain aliases. My SHELL is tcsh (can't change that). I tried the following #!/bin/tcsh alias log 'less ~/logs/log.`date '+%Y%m%d'`'' Then I ...
2
votes
0answers
46 views

Color coded 'ls' under ssh connection from Mac to SunOS server (tcsh shell)

I'm on a Mac under OSX. I ssh into a remote server which is running SunOS. The default shell under the remote server is tcsh, not bash. How can I set the ls to generate color coded output as I have ...
2
votes
1answer
84 views

tcsh: how can we display the body of a foreach loop in history

I see that history doesn't display the body of loops. Is there a way to show them? san: cd /tmp/test san: touch abc san: touch def san: ls abc def san: foreach file ( `ls` ) foreach? echo "File is $...
0
votes
0answers
20 views

MacOSX Terminal in TCSH shows this dialogue on startup “TERM=xterm-256color: Command not found.”

When I do echo $TERM in terminal it says "xterm-256color," so that's fine. And I know that the "xterm-256color" location is in /usr/share/terminfo/78/, so the location of the term exists. However, ...
0
votes
0answers
16 views

How to list available executables in tcsh?

I want to be able to list all executables starting with "prefix" available in path (whether they are scripts, shell functions or aliases), and store the list in a variable. In bash, I would be able to ...
3
votes
2answers
902 views

In csh/tcsh, how can I incorporate literal curly braces into a command that's processed with eval?

To give more details, the situation is this. I'm trying to prepare modulefiles (i.e., of the type used by the environment-modules package) to set up environment and aliases for third-party software. ...
1
vote
0answers
27 views

How to make an interactive subshell in tcsh?

How can I make an interactive subshell in tcsh? E.g.: % alias pathfrom 'cd `pathto -f`' ... where "pathto" is a script that asks the user (via STDOUT) for input (via STDIN) and prints a string in ...
1
vote
2answers
96 views

bash like --init-file in the tcsh

The bash/screen scenario: screen -dmS sessionname -c /path/to/screenrc the /path/to/screenrc contains for example screen -t windowtitle1 bash --init-file /path/to/window1.bashinit screen -t ...
0
votes
1answer
31 views

Red Hat 7 terminal does not open in cwd

I just got upgraded to Red Hat 7 and am getting used to the changes. One thing I immediately noticed was that when I press Ctrl-Shift-T to open a new terminal tab, it defaults to / rather than the ...
1
vote
1answer
252 views

256color terminal flickering in Konsole

I'm trying to setup 256 color mode at work for my Vim setup and it just refuses to work correctly. I'm using Konsole as my terminal emulator and my shell type is tcsh. I found a perl script named ...
2
votes
2answers
107 views

Run tcsh with arbitrary startup script

I want to create a new instance of tcsh and source an arbitrary script, all in one step. The problem is that when I use the -c option, the shell instance closes as soon as the script is complete. So,...
2
votes
2answers
100 views

How to set a time length of ssh and redirect the error message

I have a hostlist and there are several hosts. I want to use ssh to connect to them. I want to see whether the host is available or not by the time length of ssh takes. If it take long than 5s (which ...
10
votes
1answer
695 views

How to make auto complete available for directories in cdpath for tcsh?

I just learned the trick for setting up cdpath in tcsh and it looks pretty useful. However, it seems that auto-complete of sub-folder names doesn't come with it. Is there any trick available on that? ...
0
votes
1answer
13 views

tsch: tab-complete filename after --flag=

One the small annoyances I have in my daily use of tcsh is when I start writing a command like this: # do_stuff --input=/path/to/some I wish to use tab-completion to finish writing /path/to/some/...
1
vote
1answer
220 views

How can we configure paths for .cshrc

Within a shell script, i am trying to open a new tcsh shell and load some set of pre defined aliases and env variables which i do not want to have in default cshrc. I cannot have it in my home dir ...
0
votes
0answers
228 views

Run script on SSH login to server

I'm trying to work out how to get SSH to run a script before passing a shell to me. The reason for this is that I will be logging into shared users on many boxes and I want my own configuration when I ...
0
votes
1answer
181 views

I have a ~/.cshrc file that is sourcing another file, which should source an additional file but is not

I recently inherited an administration role for my lab and I'm still fairly new to this... so hopefully this question makes sense. Our system is set up so that one server hosts the data/user ...
1
vote
3answers
62 views

Copying multiple files on linux

I have a linux machine with folders named numerically. How can I securely copy ranges of these folders to another server? The source machine runs tcsh, the target bash. At the moment, from the ...
0
votes
1answer
80 views

How can I make printf print unicode characters saved in a variable?

I have this code to print a horizontal line using unicode character \u2501: #!/bin/tcsh set horz_line = "'" foreach x (`seq 1 1 80`) set horz_line = "${horz_line}\\u2501" end set horz_line = "${...
2
votes
1answer
415 views

Is it possible to display 'special' characters in tcsh prompt running on gnome-terminal?

I'd like to know whether its possible to do special characters like so in tcsh prompt running on gnome-terminal. I remember seeing a 'skelton-head' in someone's prompt a while back. Things like that....
2
votes
2answers
677 views

“which” Program Requires Shell Refresh to See Newly Installed Programs?

Why does the Linux program which require you to refresh the shell (e.g. type tcsh in the terminal) to see new programs installed in your path?? I was baffled why I couldn't access a program, which ...
1
vote
1answer
799 views

cd Command Linux and Mystery Flags

Platform: CentOS 6.2 Shell:tcsh I'm playing around with cd for a BASH script, and noticed the wondrous cd - option, but was left with many questions... Why the cd -? Isn't this redundant with cd .....
0
votes
1answer
596 views

grep: Invalid back reference for date expression in tcsh

I googled for the following error, and didn't get any great explanations as to what was going on with grep under tcsh. (Yes, that date expression exists in the log files). $ grep '2014-07-21' *.log ...
2
votes
1answer
489 views

bash 4.2 autocd command default over directory

Just switched from tcsh to bash 4.2 on OSX, and autocd was what allowed me to do it. But it seems that by default if you type the name of a directory that also happens to be the name of an executable ...
0
votes
2answers
1k views

Suppress 'Warning: no access to tty' in ssh

I have a short simple script, that compiles a .c file and runs it on a remote server running tcsh and then just gives back control to my machine (this is for school, I need my programs to work ...
2
votes
2answers
708 views

On Linux (CentOS 5), remembering when we've followed a symlink and being about to 'cd ..' out again

I'm trying to figure out how to tell the shell (tcsh) to remember when I've gone into a symlinked folder, and allow 'cd ..' to navigate back out of the symlink rather than just navigate to the parent ...
1
vote
1answer
1k views

Use “>>” Redirection Operator for Non-Existent File In tcsh/csh

I'm writing tcsh scripts and I would like to append to a log file, but if the log file doesn't exist before appending to it, I get an error (reproduced below). In bash the file gets created if it ...
1
vote
4answers
332 views

rm matching file names by pattern

I have 42000+ Project Gutenberg epubs. Often a release has both an images version and a no-images version. I want to remove the no-image copies if there is an image copy. ... pg16045-images.epub ...
2
votes
2answers
150 views

Is this alias any useful?

I am going through and old .cshrc file and it contains the following alias: alias pwd 'echo $cwd' How is that useful? I used to think that this is how pwd might have been implemented. But looks ...
2
votes
1answer
636 views

Echo string in tcsh with special characters escaped

Is it possible to echo out a string in tcsh such that it is fully escaped, as tcsh would understand? In the same way as printf %q works in bash: % # Create a variable containing a tab character % ...
13
votes
6answers
9k views

How can I automatically update the title in an xterm running screen?

This is a bit of a followup to this question. I'm working in tcsh within GNU screen in an xterm. I have the following in my .cshrc: alias res_t 'xtset -t %h:%d "(%u:%g)" %e' # reset titlebar ...
1
vote
1answer
88 views

How do I execute savehist for tcsh history if my machine froze?

My MacBook Air froze all of a sudden: the keyboard, trackpad and display are all unresponsive. However, ssh works. I have one tcsh session active. Which signal do I send to tcsh for it to ...
0
votes
1answer
969 views

No entry for terminal type "xterm-256color-256color

I recently added the following (below) to .mycshrc to allow 256 color xterm and allow command line vim to operate in 256 colors, however certain command line tools like less have thrown errors xterm-...
0
votes
2answers
681 views

Copying a template header to multiple existing files

I have a bunch of *.csv files that use headers. Right now the files have headers and the same number of lines of data. I need to erase the data in these files, so I figured I could just overwrite the ...
1
vote
2answers
228 views

How do I make an alias work when I need to invoke more than one binary in the same command?

Say I have two binary files: binary1 and binary2. Each of them has its own option set: options1 and options2. Users need to invoke a command that follows this structure: binary1 options1 binary2 ...
0
votes
1answer
539 views

Tcsh command history

I use tcsh and have the following in my .cshrc file. But the .history file is not updated as and when I execute a command. Is there anyway so that .history file is updated every time I execute a ...
0
votes
1answer
869 views

Writing a tcsh script to copy files specified in first argument to a specific directory

I'm trying to write a script in tcsh that will copy select files that I specify at the command line from one directory to another without having to write out the entire path of each file. Also, to ...
1
vote
1answer
162 views

Arbitrary code execution in tcsh prompt?

I'd like to customize my prompt to include the output of an arbitrary command, like you can do in bash (e.g., I'd like to cat a file and have its (one-word) contents appear in the prompt, or show the ...
4
votes
3answers
9k views

Redirect stdout to stderr in tcsh

From my understanding, the following should send 'test' on standard error in tcsh: echo test >&2 However, it instead writes 'test' to a file named 2, and when I look through my history, I ...
1
vote
2answers
458 views

tcsh shell not autocompleting *.log files for vi

When trying to autocomplete a file name for vi, files ending in .log are not listed as options. How can I correct this?
2
votes
1answer
1k views

Linux: How to eval the contents of STDOUT?

Consider you have a file with some sort of terminal command. How might each line be executed? Can you pipe the output of more into an eval? %> more ./foo.txt Edit: After some help/guidance ...
0
votes
0answers
46 views

Use two different completions in tcsh

I want to make a tcsh completion that completes with both a relative directory (ie p/*/d/), or the output of a command (ie p/*/'completionterms'/). Is this possible? Looking at the tcsh man page it's ...
2
votes
1answer
39 views

List directories without erroring if none exist

I have a rather strict set of specs for a directory listing that I need: It must list the directories in the current directory It must list purely the basename (no "./", no trailing slash) It mustn'...
3
votes
1answer
2k views

How to get rid of errors when running find command in Linux?

I am using following command to list out 20 large files in a directory. But along with the file listing, it also shows error messages, such as permission denied. I tried adding 2> /dev/null but it ...
1
vote
0answers
587 views

csh: Every command returns “no match”

I'm on mac OSX mountain lion working with csh. I'm not quite sure what I did, but suddenly every standard unix command I run returns a "no match". Example: $ echo "Hello" echo: no match $ rm a.txt ...
2
votes
2answers
2k views

How to open xterm shells with background colors based on topographic positioning?

I currently use an alias in csh/tcsh to open shells with specific window colors. Example: xterm -geometry 105x25 -font 8x13 -bc -bg #333 -fg #999 \!* & What I'd like to do is have one command ...
7
votes
3answers
431 views

vim can not execute unix command with :! due to shell changing

Our company uses red hat linux system and allocate everyone an account in /home. Unfortunately, our system is using tsch, which is not favorable for me. Moreover, as I do not have the super user ...
0
votes
2answers
765 views

sudo in CentOS 6.1 does not preserve command aliases as sudo elsewhere does?

On a stock CentOS 6.1 installation, if I start in my user shell (tcsh) with all my usual command aliases and do what I normally do (in other versions of Linux, and Mac OS X) to get a root shell, ...