tcsh

bash vs csh vs others - which is better for application maintenance? [duplicate]

烈酒焚心 提交于 2019-12-03 02:08:52
This question already has answers here : What Linux shell should I use? [closed] (19 answers) Possible Duplicate: What Linux shell should I use? I am starting to get proficient in a Linux environment and i'm trying to pick a weapon of choice in terms of command shell scripting (as i'm still a big n00b at this) that will help me (and others) manage, test and administer a set of server side applications running on a *NIX environment. My question is: What is(are) the preferred command shell(s) out there when the following criteria are considered: How easy is it to learn/understand for a junior

Ctrl-R to search backwards for shell commands in csh

孤者浪人 提交于 2019-12-03 01:19:29
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 DigitalRoss 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 command that had hello.c anywhere in it. Try bindkey "^R" i-search-back 来源: https:/

How to color a prompt on FreeBSD/cshrc?

心不动则不痛 提交于 2019-12-03 00:19:07
I'm being put in charge of managing a bunch of servers, I want to set up my prompts on each of them so that I don't get confused as to where I am logged in to. I've edited my .cshrc files and put this in them: set prompt=`whoami`@`hostname -s`:$cwd'$ ' But I'd like to color that prompt so it stands out a bit more. Maybe green with white text or something. How can I do that? I'm not very familiar with the shell syntax. I'm SSH-ing in from the standard terminal that comes with Ubuntu, if that's relevant. mpen This page has a pretty good explanation, although the syntax is a bit different in csh

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

我们两清 提交于 2019-12-02 15:48:27
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 the output in color :( ls -ltra | grep '\->' ChristopheD Find all the symbolic links in a directory: ls

Accessing array elements with spaces in TCSH

泄露秘密 提交于 2019-12-02 10:07:11
I'm trying to create a small little convenience script for our team. Unfortunately, our entire build environment is based on tcsh for historical reasons. In the following script, each element of BUILD_MATRIX is a : delimited pair. I need to separate out each part of this pair for processing, but the array malfunctions for some reason. #!/bin/tcsh set BUILD_MATRIX = ( "makefile.make:make --jobs --makefile=makefile.make" \ "Makefile:make --jobs --makefile=Makefile" \ "build.xml:ant" ) foreach pair ( ${BUILD_MATRIX} ) echo "pair: ${pair}" end gives pair: makefile.make:make pair: --jobs pair: -

why is a double-quoted awk command substitution failing in csh

落花浮王杯 提交于 2019-12-02 08:55:07
Using C shell, the following command-line set pf = "`awk -v var=$pd '{if($1<0) print var, $2, $3}' test.txt`" returns an error in awk: awk: {if( <0) print var, , } syntax error. This is especially puzzling as the command itself works without any problem: awk -v var=$pd '{if($1<0) print var, $2, $3}' test.txt Is there a way that we can store all output of the single Awk command line into a single variable? What is the reason the above is failing? After some tinkering, I can only come to the conclusion that it is one of those C-Shell quirks. C-shell ( csh or tcsh ) is apparently notoriously

Generating sequential number lists in tcsh

我是研究僧i 提交于 2019-12-02 02:12:50
问题 I've been trying to find a workaround to defining lists of sequential numbers extensively in tcsh, ie. instead of doing: i = ( 1 2 3 4 5 6 8 9 10 ) I would like to do something like this (knowing it doesn't work) i = ( 1..10 ) This would be specially usefull in foreach loops (I know I can use while, just trying to look for an alternative). Looking around I found this: foreach $number (`seq 1 1 9`) ... end Found that here. They say it would generate a list of number starting with 1, with

Tcsh run command if command was run

痞子三分冷 提交于 2019-12-01 23:51:13
I'm not really familiar with TCSH I would like run a command2 if a command1 was entered in the shell, something like this: if command1 then echo "Command succeeded" command2 else echo "Command failed" fi I tried this code but it doesn't work. Step two would be to read and print in a file a part some variable that command1 changed (making a kind of history only for some variables). You can use $? to get exit code from last command. #!/bin/tcsh # command below can fail or succeed command1 if ( $? == 0 ) then command2 else echo "command1 failed" endif 来源: https://stackoverflow.com/questions

multi-line variable in tcsh

China☆狼群 提交于 2019-12-01 06:04:04
I want to have variable in tcsh to hold the usage info of my script, so in my script, whenever I write echo $usage, it will print my_script -h : -help -b : do boo etc`. Is there a way to do this? Can this be done using the << EOF ? I've tried something like this, but it failed: set help = << EOF my_script -h : print help -b : do boo EOF thanks set help = 'my_script\ -h : -help\ -b : do boo' echo $help:q Another approach: alias help 'echo "my_script" ; echo " -h : -help" ; echo " -b : do boo"' help But see also: http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ I've been using csh and tcsh

multi-line variable in tcsh

*爱你&永不变心* 提交于 2019-12-01 04:06:27
问题 I want to have variable in tcsh to hold the usage info of my script, so in my script, whenever I write echo $usage, it will print my_script -h : -help -b : do boo etc`. Is there a way to do this? Can this be done using the << EOF ? I've tried something like this, but it failed: set help = << EOF my_script -h : print help -b : do boo EOF thanks 回答1: set help = 'my_script\ -h : -help\ -b : do boo' echo $help:q Another approach: alias help 'echo "my_script" ; echo " -h : -help" ; echo " -b : do