command substitution with tcsh


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers command substitution with tcsh
# 1  
Old 12-08-2008
command substitution with tcsh

I was trying to modify my .cshrc file so that the full path would always be displayed in my command prompt. After doing a search, I was able to accomplish this by adding these lines to my .cshrc file:

Code:
alias	 setprompt    'set prompt="%/% "'
setprompt

alias    cd           'chdir \!* && setprompt'
alias    pushd        'pushd \!* && setprompt'
alias    popd         'popd \!* && setprompt'

What exactly are the "\!*" characters doing (without the quotes)? I did some searching and know it has something to do with command substitution, but can anyone tell me exactly what that sequence of characters means?
# 2  
Old 12-09-2008
It's just the arguments to your aliased command. i.e.
Code:
cd asdf

is expanded to
Code:
chdir asdf && setprompt

However, I don't believe those aliases are at all necessary to set your prompt. All you need is
Code:
set prompt = "%/% "

and tcsh will change your prompt when you change directory,
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tcsh script - sed command for special characters

Hi, I am using sed command to replace following line in gz file- sed -n 's/""COS_12_TM_1" ( 1101110101001001010011110100000010110100010010000000100000000010XX010000000 )"/""COS_12_TM_1" ( 110111010100100101001111MM00000010110100010010000000100000000010XX010000000 )"/g' filename.gz $x=... (4 Replies)
Discussion started by: Preeti Chandra
4 Replies

2. UNIX for Dummies Questions & Answers

Tcsh command for assigning output of awk to variable

Hi I have a text file with 2 values and I am trying to assign each value to a variable and then write those to text files. So if the textfile is data.txt with 2 values x and y I want to assign mean=x, and stdev=y and then write these out in text files alongwith the id ($id has already been... (6 Replies)
Discussion started by: violin
6 Replies

3. Shell Programming and Scripting

Regarding command substitution

Oracle Linux 5.6, 64-bit Given the following snippet wrkvar=`sqlplus -s / as sysdba <<EOF set echo off feedback off head off trimsp on select count(*) from v\$parameter where name in ('db_file_name_convert','log_file_name_convert') and value is not null; EOF` echo wrkvar=$wrkvarProduces... (2 Replies)
Discussion started by: edstevens
2 Replies

4. UNIX for Dummies Questions & Answers

read command - using output from command substitution

Hey, guys! Trying to research this is such a pain since the read command itself is a common word. Try searching "unix OR linux read command examples" or using the command substitution keyword. :eek: So, I wanted to use a command statement similar to the following. This is kinda taken... (2 Replies)
Discussion started by: ProGrammar
2 Replies

5. Shell Programming and Scripting

running zsh command in tcsh

Hi all is there a way to run zsh commands in a tcsh shell thanks (3 Replies)
Discussion started by: ab52
3 Replies

6. UNIX for Dummies Questions & Answers

sed insert command and variable expansion/command substitution

I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename? #!/bin/bash filename=`echo $0` /usr/bin/sed '/#include/ { i\ the filename is `$filename` }' $1 exit 0 (8 Replies)
Discussion started by: glev2005
8 Replies

7. UNIX for Dummies Questions & Answers

at crontab tcsh setenv: command not found

i have written a script "master.shell" which is in the path: /a/homes.surrey.ac.uk/pgt_fs_002/bl00001/phd/griddata/shell/master.shell ==================================== #/usr/local/bin/tcsh setenv GLOBUS_LOCATION /grid/software/globus3 setenv PATH... (1 Reply)
Discussion started by: binbintriangel
1 Replies

8. UNIX for Dummies Questions & Answers

assigning (numeric) command output to var tcsh

Hello, I'm trying to assign a numeric value that is returned from one of my programs to a variable in tcsh. I want to do: @ r10 = './my_prog file 35' where ./my_prog file 35 returns a decimal value, but this doesn't work. How do I achieve the desired result? Janet (4 Replies)
Discussion started by: psran
4 Replies

9. UNIX for Advanced & Expert Users

tcsh read command ......?

i have just started to use the tcsh shell as a sort of personal challenge since I see so many users using other shells than just bash... I have written a spcript that is quite lengthy but it is in bash shell and gives an error message in tcsh shell so I cut the script in half and basically... (4 Replies)
Discussion started by: moxxx68
4 Replies

10. Shell Programming and Scripting

Substitution of last command

"Is there any substituation of last command or script syntax which can be used as a user. As far I know the "last" command is being used to display information about previous logins. A member of adm group or the user adm can execute it only. Thanks in advance for your usual help. Ghazi (6 Replies)
Discussion started by: ghazi
6 Replies
Login or Register to Ask a Question