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
1 vote
1 answer
43 views

Converting a tcsh alias into zsh

I had a tcsh alias as follows: alias cdd 'cd `dirname \!*`' I use this to change the directory to the one containing a certain file. For instance, cdd /Users/myself/Document/Folder/File.pdf would ...
leparc's user avatar
  • 13
1 vote
1 answer
80 views

DISPLAY=:0: Command not found

user@domain:~ $ echo $DISPLAY :0 user@domain:~ $ DISPLAY=:0 DISPLAY=:0: Command not found. Just trying to run the command here: https://stackoverflow.com/questions/46810043/notify-send-doesnt-work-...
ProgrammingFreak's user avatar
3 votes
2 answers
112 views

Bash equivalent of tcsh M-$?

Way back while studying I used tcsh as my main shell and it had this nifty feature of being able to correct a misspelled command name by pressing Escape-$ which would the. change eg “bsah” to “bash” ...
Thorbjørn Ravn Andersen's user avatar
0 votes
1 answer
20 views

tcsh equivalent of bash command (deleting all but 10 most recently modified directoies)

Below keeps latest 10 directories and delete the rest. Works fine with bash. What would be TCSH equivalent to bash below? keep = 10 rm -r $(ls -dt */ | tail -n +$((keep+1)))
Aldron's user avatar
  • 1
0 votes
0 answers
58 views

tcsh way of pattern substitution

I am using tcsh shell with Jenkins. In short, the matching suffix should be removed from the output. Achieved in bash with the following. cd ${WORKSPACE%${JOB_NAME}} Case: Given the following ...
Aldron's user avatar
  • 1
0 votes
1 answer
156 views

Replace backslash path for forward slash path with sed in loop

I want to replace windows server paths (\\100.100.0.0\aaa\bbb\ccc\) with linux paths /foo/bar/ on all occurrences inside all .txt files in a folder (/xxx/yyy/zzz/). For that I made a loop that does ...
CodingPear's user avatar
0 votes
0 answers
111 views

I am writing a cronjob, I need a command that confirms that some of the files are successfully transferred from an MFT server to my local server

I use the following command: sftp -o "StrictHostKeyChecking" -r -P [portNumber] technicalUser@hostName:/path/2022* /LocalPath After I execute the above command, all of the files which start ...
Kawhi Goat's user avatar
1 vote
0 answers
322 views

What are the color options in tcsh?

I was recently required to move to the tcsh shell and I was wondering about colors. Especially what is the difference between the following: setenv CLICOLOR 1 set color set colorcat Which one do I ...
user avatar
1 vote
1 answer
79 views

How to search DuckDuckGo with the command-line (tcsh)?

There is a simple function I use a lot to look up things on the web In Fish function ddg set URL "https://duckduckgo.com/?q=$(echo "$argv" | tr " " "+")" ...
user avatar
0 votes
0 answers
122 views

recursive history search for tcsh shell

In bash shell, i generally use CTRL+R to fuzzy search a command that i executed recently. However the same doesn't seem to work for tcsh or csh shells. I want to understand if/how to do the same ...
Anuraag Tummanapally's user avatar
0 votes
1 answer
385 views

How to pass a variable to a sed command in a csh script?

Unix & Sed noob here! I have a requirement where I need to put a suffix ",waive" in case a line in a report containing a matching string.The matching string is part of another file "...
Aditya's user avatar
  • 3
1 vote
0 answers
528 views

How to redirect the stderr to /dev/null and the stdout to the pipe in tcsh?

I have the following code in tcsh: set dirs = `find $path -follow -name "test" | grep -v ".data"` It will find all the directories that have test directory under it, without ...
vesii's user avatar
  • 193
0 votes
0 answers
140 views

C shell and mesa installation

I am trying to install mesastar following these instructions: http://user.astro.wisc.edu/~townsend/static.php?ref=mesasdk I do not have C Shell from prerequisites. I have Linux mint and tried sudo apt-...
Anna-Kat's user avatar
  • 115
0 votes
3 answers
67 views

put text along with unix command then feed to a file

In the tcsh shell on Unix, I would like to print the folder name together with the number of files that I searched, then feed it to a file. However I just manage to find the number of count then write ...
Grace's user avatar
  • 103
1 vote
2 answers
1k views

while command not working when bash script is sourced in tcsh?

I had made a bash shell script which include while command but when I run the script using source command on terminal, it gives a syntax error message. I need to use source because I have to set the ...
vikas's user avatar
  • 19
2 votes
1 answer
444 views

In tcsh, how can I keep '{' '}' in assigning a variable?

I am making a simple shell script using the tcsh shell. I assigned a variable as a command to use later. But brackets within single quotes disappear. set aaa = "test '10' '{}' ' " ; echo $...
aroman's user avatar
  • 23
0 votes
0 answers
134 views

using 2 alias together in cshell terminal

lets say I have 2 aliases, each having multiple arguments. It looks somewhat like below example alias s1 "command1 -a -b -c" alias s2 "command2 -d -e -f" now if I run :s1 s2 in ...
Krishanu Banerjee's user avatar
8 votes
2 answers
2k views

Avoiding non-zero exit code when running `ls` using multiple patterns

Say I have two possible paths I want to list directories and files under on a Linux machine: /some/path1/ /some/path2/ If I do the following in tcsh, I get 0 exit code, if at least one of path1 or ...
shikhanshu's user avatar
0 votes
1 answer
41 views

how to translate this bashrc code to suse 11 commands

I am trying to link MATLAB with Cadence Virtuoso (an electrical engineering software) in SUSE Linux 11, and I have manual PDF that is the guide to do so. My problem is that the commands that are given ...
TheDeparted's user avatar
2 votes
1 answer
506 views

tcsh scripting - keep newlines of grep results

I am writing a simple script in tcsh (apparently that's a bad idea, but well) to grep some patterns from a text file. Say we have a file animal_names.txt which consists of: dog carrot dog bolt cat ...
Hanz's user avatar
  • 33
0 votes
2 answers
1k views

using awk with variables in a shell script

I have a file called "random" that looks like this: A B C D A B C D A B C D How can I get this shell script to print up the second column? #! /usr/bin/tcsh -f set variable = "2" ...
ZakS's user avatar
  • 285
0 votes
3 answers
3k views

loop through file by row in tcsh

This is a very similar question to How to loop over the lines of a file?. I have a file with rows with n fields, separated by spaces. I want to loop through this file by row, and use the set the ...
ZakS's user avatar
  • 285
2 votes
1 answer
74 views

Debian tcsh not respecting locale for character class expansion

Using Debian 11, tcsh version tcsh 6.21.00 (Astron) 2019-05-08 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,nd,color,filec In a directory with two files, a and A, $ echo [a-z] a A This ...
Jon's user avatar
  • 51
0 votes
1 answer
794 views

Changing terminal prompt in `tcsh`

My terminal shell prompt defaults to [johnnine@tec ~]$. How should I use "set prompt" in ~/.cshrc, so that it also displays time?
WitchPath's user avatar
0 votes
1 answer
58 views

Running a program with the same as an existing command

Let's say I make a runnable program called "xeyes.exe" in my current directory. When I type the command "xeyes" into the command prompt, why does the program run instead of the ...
WitchPath's user avatar
1 vote
2 answers
772 views

Use bash instead of tcsh for non-interactive shells

I have an environment similar to the one in this question: Different shells for interactive and non-interactive work I'm currently stuck with tcsh as my "official" default shell. For ...
Chris Weber's user avatar
0 votes
1 answer
354 views

Behaviour of single and double quotes depending on shell

I've been scratching my head for quite some time with this.... Inspired by this answer, I'm trying to run 'ack' and to find either a single quote or a double quote in source files. Doing this in bash ...
DaveC's user avatar
  • 1
-1 votes
2 answers
82 views

Syntax to select a group of files based on extension?

I have several files in the following form, Group - 1 file1.n001 file2.n002 file3.n003 file4.n004 : : : filex.nx Group - 2 file1.ntemp file2.nreal : :etc In order to remove only files, with ...
The_Learner's user avatar
0 votes
1 answer
97 views

Access the shell printout that resulted from the previous command

I have to run a command that prints out a message in my shell, with a path to a file. >> myCommand.py >> outputs path to file I'd like to know if this message is stored anywhere so that I ...
ZakS's user avatar
  • 285
0 votes
0 answers
2k views

C-shell prompt color

I wan to change the color of my csh shell. I've edited my .cshrc file, following the instruction I've found here, and included this in it: set yellow="%{\033[1;33m%}" set end="%{\...
Mr.Seven's user avatar
0 votes
1 answer
291 views

TCSH: 'Can't find string terminator' Error From perl -e in TCSH Script

I'm seeing this error from my tcsh script and I can't figure out why. Script: #!/usr/bin/env tcsh foreach n (0 1) set PERL_CMD = "perl -e 'print qq^RUNNING^; exit ${n} '" echo "...
ercousin's user avatar
1 vote
2 answers
718 views

How to quote exclamation marks in file names in a tcsh shell script with find and awk?

I have a script that searches for space characters ' ', exclamation marks '!' and dollar signs '$' in filenames and replaces each with an underscore '_'. However, it does not handle file names with ...
Ned64's user avatar
  • 8,516
2 votes
0 answers
75 views

tcsh and matching [0-9]

I have a rather odd situation where [0-9] matching is not working under tcsh (but working under csh and bash). here is an example: muon:~/tmp.52 ls a0 a1 a2 a3 a4 a5 a6 apollo_help.docx* muon:~/...
itstime2b's user avatar
0 votes
0 answers
83 views

How can I prevent standard output from displaying as a standard error in csh or tcsh?

When executing a process in the background using '&', the standard output goes to standard error. This happens if an error is detected in the standard error output when executing a command, or if ...
leto's user avatar
  • 101
0 votes
3 answers
831 views

Applying numfmt on a specific column in awk

I'm writing a script in tcsh (yes... I know but I have to) to analyze all users disk usage in a specific directory. In the end, I want to produce a report in the next format: user1 1.6GB user2 1.1GB .....
Michael S's user avatar
-3 votes
1 answer
287 views

Issue processing multiple files, counting lines

Sorry if it's long and confusing, but I have three files, namely cat, dog, and cow. My code is something like this: echo -e "Enter file name: \c" read filename #saves ...
Wenhan Xiao's user avatar
0 votes
1 answer
1k views

Count number of lines in file and save result to new text file [closed]

I want to count the number of lines in a file called "cat" my script to run in CMD is echo -e "Enter file name: \c" read filename wc -l $filename which leads to result [24 cat] ...
Wenhan Xiao's user avatar
1 vote
1 answer
4k views

loop with array in TCSH shell

In TCSH : I'm giving two lists containing different files in it. Then I have to pass those list as an array element and then the loop should execute twice as there are only 2 lists. But in this case ...
user466919's user avatar
1 vote
0 answers
546 views

How to run command with tcsh and keep the shell alive?

I'm using tcsh. I want to open a new interactive tcsh shell and run command. I want to do it like: tcsh -c <command> The problem is that tcsh executes the command and exits the interactive ...
vesii's user avatar
  • 193
3 votes
1 answer
2k views

Using single quotes inside input of heredocs

I need some help debugging my tcsh script. It uses heredocs. The code: <pre_setup> <<EOF1 <setup> <<EOF2 <command> exit 0 EOF2 exit 0 EOF1 The <pre_setup> is ...
vesii's user avatar
  • 193
0 votes
2 answers
691 views

What does it mean <<EOF in (t)csh?

I have the following command: wash -n <groups> <<EOF echo hi echo bye <<BYE <commands> exit 0 BYE exit 0 EOF <commands> where <groups> are some groups and <...
vesii's user avatar
  • 193
0 votes
1 answer
142 views

assign letters to jump forward and backward in bash

My default shell is tcsh. In my .cshrc file. I have bindkey -v, so that at the command line, the letters b and w jump backwards and forwards a word, respectively. I'd like to set up bash so that ...
Leo Simon's user avatar
  • 443
1 vote
1 answer
118 views

recover a directory moved into itself

Through shell shortcuts I accidentally moved a dir into itself and now it seems to have disappeared. Here is the sequence cut-n-pasted directly from the terminal: $ chmod a+x load_test_set.sh ~/bin $ ...
JimK's user avatar
  • 13
2 votes
0 answers
3k views

How to escape all of the special characters in order to be able to print the string as is?

I'm creating a tcsh script on the fly (with a static language). I have a <add-command-here> section that contains some command. I want to do: echo <add-command-here> In that <add-...
vesii's user avatar
  • 193
5 votes
1 answer
4k views

When defining an environment variable, I get "Command not found"

When I type HELLO="hello", I would expect to create an environment variable called HELLO. Instead, I get the error HELLO=hello: Command not found. What could be going wrong here? I am on ...
Liam Bohl's user avatar
  • 161
0 votes
1 answer
1k views

for loop in FreeBSD (pfSense) doesn't work

I've just noticed that the same code for for loop in bash doesn't work in FreeBSD wolf@linux:~$ echo $SHELL /bin/bash wolf@linux:~$ wolf@linux:~$ for i in {1..3}; do echo $i; done 1 2 3 wolf@linux:~$...
Wolf's user avatar
  • 1,511
3 votes
1 answer
229 views

tcsh grep trouble

I use FreeBSD > uname -sr FreeBSD 6.3-RELEASE When I query > grep `whoami` /etc/passwd It shows me the information I want: But when I try getting it in a tcsh script: #!/bin/tcsh set login = `...
Григорий's user avatar
0 votes
1 answer
183 views

xterm is calling .cshrc twice

I'm running ubuntu 18.04, I've asked this question on askubuntu, but got no response, so I thought I'd ask on a different forum, hoping for a different readership. I do know that the same problem ...
Leo Simon's user avatar
  • 443
0 votes
2 answers
52 views

sourcing in bash doesn't mimic sourcing in tcsh

The file below, which I've called /tmp/ltSortedList, when sourced in tcsh, outputs lines in different colors: echo "\033[0;34m R:0 2020 12 10 18:53 regularFile "\\e[0m echo &...
Leo Simon's user avatar
  • 443
0 votes
1 answer
231 views

PATH behaves differently in bash and csh when directory is execute only?

We have some applications in various subdirectories that we limit access to by unix group, and we want them to be execute only. So, for example, if we want members of the "chem" group to ...
Peter's user avatar
  • 3

1
2 3 4 5
7