tcsh

How to map Delete and End keys on tcsh shell?

China☆狼群 提交于 2019-12-05 16:54:18
问题 I use tcsh , and when Delete/End is pressed on cmd line, it simply shows up as ~ ; I have to press <Ctrl><e> to go to end of line. Can anyone help me to be able to use Delete/End keys as their name suggests ? 回答1: Those keys already worked on my Debian system. I found these commands in the /etc/csh.cshrc file: if ($?tcsh && $?prompt) then bindkey "\e[1~" beginning-of-line # Home bindkey "\e[7~" beginning-of-line # Home rxvt bindkey "\e[2~" overwrite-mode # Ins bindkey "\e[3~" delete-char #

Tcsh script does not exit

岁酱吖の 提交于 2019-12-05 12:36:53
I am running CentOS 7, and I am having problems with tcsh scripts. I have a simple script called quittest. #!/bin/tcsh echo "Simple Test" exit 0 When I run quittest from the terminal, I get "Simple Test" And it does not exit. I can Control+C to exit. I check on the status of this with: ps aux and it shows quittest with a state of S+ (foreground interruptible sleep). If I change this script to bash, or sh, it runs fine, and exits as expected. I cannot just switch to another shell, because my users have very complex scripts written with tcsh. We are replacing OpenSuSE 12.3 with CentOS 7. Tcsh

minimal typing command line calculator - tcsh vs bash

纵然是瞬间 提交于 2019-12-05 10:25:24
I like to have a command-line calculator handy. The requirements are: Support all the basic arithmetic operators: +, -, /, *, ^ for exponentiation, plus parentheses for grouping. Require minimal typing, I don't want to have to call a program interact with it then asking it to exit. Ideally only one character and a space in addition to the expression itself should be entered into the command line. It should know how to ignore commas and dollar (or other currency symbols) in numbers to allow me to copy/paste from the web without worrying about having to clean every number before pasting it into

How to run a tcsh shell command and selectively ignore the status?

别等时光非礼了梦想. 提交于 2019-12-05 10:13:16
I've got a tcsh shell script that I would like to stop with an error on nonzero status most of the time, but in some cases I want to ignore it. For example: #!/bin/tcsh -vxef cp file/that/might/not/exist . #Want to ignore this status cp file/that/might/not/exist . ; echo "this doesn't work" cp file/that/must/exist . #Want to stop if this status is nonzero I don't know about tcsh, but with bash, you can use set -e to do this. When the -e flag is set, bash will exit immediately if any subcommand fails (see the manual for technical details). When not set, it will continue to execute. So, you can

Redirecting stderr in csh

北战南征 提交于 2019-12-05 02:13:07
I'm executing a program that dumps crash report into STDERR from where I have to filter some necessary information. The problem is that I'm unable to redirect STDERR to STDOUT and PIPE it with grep command 2>&1 >/dev/null | grep "^[^-]" >& /tmp/fl Getting error: Ambiguous output redirect. Same command works under bash terminal. What should I change to make it work ? csh is significantly more limited than bash when it comes to file redirection. In csh , you can redirect stdout with the usual > operator, you can redirect both stdout and stderr with the >& operator, you can pipe stdout and stderr

How can I find the location of the tcsh shell script I'm executing?

时光总嘲笑我的痴心妄想 提交于 2019-12-05 01:43:54
Say I put an executable tcsh file in /path/to/my_script.csh and my current directory is anywhere, for example I'm in /path So I type to/my_script.csh I want to have a line in my_script.csh that will return "/path/to/my_script.csh" - like ruby's __FILE__ If you want to ensure the same result (full path and script name) try something like this: ... rootdir=`/bin/dirname $0` # may be relative path rootdir=`cd $rootdir && pwd` # ensure absolute path zero=$rootdir/`/bin/basename $0` echo $zero ... Then you can call it as foo.sh, ./foo.sh, some/lower/dir/foo.sh and still get the same result no

In python 2.4, how can I execute external commands with csh instead of bash?

删除回忆录丶 提交于 2019-12-05 01:39:22
问题 Without using the new 2.6 subprocess module, how can I get either os.popen or os.system to execute my commands using the tcsh instead of bash? I need to source some scripts which are written in tcsh before executing some other commands and I need to do this within python2.4. EDIT Thanks for answers using 'tcsh -c', but I'd like to avoid this because I have to do escape madness. The string will be interpreted by bash and then interpreted by tcsh. I'll have to do something like: os.system("tcsh

Display only files and folders that are symbolic links in tcsh or bash

会有一股神秘感。 提交于 2019-12-04 07:48:42
问题 Basically I want do the following: ls -l[+someflags] (or by some other means) that will only display files that are symbolic links so the output would look -rw-r--r-- 1 username grp size date-time filename -> somedir -rw-r--r-- 1 username grp size date-time filename2 -> somsdfsdf etc. For example, to show only directories I have an alias: alias lsd 'ls -l | grep ^d' I wonder how to display only hidden files or only hidden directories? I have the following solution, however it doesn't display

How can I check if a variable is empty or not in tcsh Shell?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 22:10:29
IF I have to check that if a variable is empty or not for that in bash shell i can check with the following script: if [ -z "$1" ] then echo "variable is empty" else echo "variable contains $1" fi But I need to convert it into tcsh shell. The standard warnings regarding use of tcsh / csh apply, but here's the translation: if ( "$1" == "" ) then # parentheses not strictly needed in this simple case echo "variable is empty" else echo "variable contains $1" endif Note, though, that if you were to use an arbitrary variable name rather than $1 in the above, the statement would break if that

Ctrl-R to search backwards for shell commands in csh

£可爱£侵袭症+ 提交于 2019-12-03 10:50:14
问题 I love this shortcut in borne shell, and want to find out if it is possible to simulate and/or have (perhaps to install an add-on or with a script) it in csh or tsch thanks 回答1: Something that csh, tcsh, and even bash have is the cool ! history substitution . % !cc This will run the last command starting with cc % cc !* That supplies the parameters from the last command. % g++ !cc:* That finds the last command that started with cc and substitutes its parameters % !?hello.c This finds the last