>& >&! in /bin/csh

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers >& >&! in /bin/csh
# 1  
Old 06-21-2016
>& >&! in /bin/csh

i am new player in linux
what does mean ">& and >&!" in script or command line?
thanks
# 2  
Old 06-21-2016
Hmm. Could you please post an example full command for each one. As they stand
>& as a command generates a syntax error, >&! is an airball (Bash 4) doing nothing all by itself on a line. Not a syntax error.
# 3  
Old 06-21-2016
for example in this command


Code:
csh Make_all.com >&! Make_all.log

from this script
Code:
#!/bin/csh
#set echo
#
# --- Usage:  ./Make_all.com >& Make_all.log
# ---         but first edit ./Make_all.src for this machine.
# ---         also need correct ./bin/ncargf90 for plot/src programs.
#
# --- make all HYCOM pre/post processing executables,
# --- except those in archive/src/Make_ncdf.com that require NetCDF
#
# --- set ARCH to the correct value for this machine.
#
source Make_all.src
#
printenv ARCH
#
if (! -e ./config/${ARCH}_setup) then
  echo "ARCH = " $ARCH "  is not supported"
  exit 1
endif
#
setenv A $cwd
#
foreach d ( archive force meanstd plot relax sample subregion topo )
  echo "PROCESSING ${d}/src:"
  cd ${A}/${d}/src
  csh Make_all.com >&! Make_all.log
  cat Make_all.log
end
#
# ./bin/Make_all.com does not use Make_all.src, but
#  should not need editing for any supported machine type.
#
echo "PROCESSING bin:"
cd ${A}/bin
csh Make_all.com >&! Make_all.log
cat Make_all.log



Moderator's Comments:
Mod Comment Thanks for trying to use code tags, but please use correctly and adequately!

Last edited by RudiC; 06-21-2016 at 10:25 AM.. Reason: Corrected code tags.
# 4  
Old 06-21-2016
Okay - thank you. You are using the c shell (csh) not bash.

Generally, experienced coders tend to avoid the c shell, because it has some issues, and I have not looked at it for too many years. Someone else can help you.
# 5  
Old 06-21-2016
According to
Code:
man tcsh

command >& file redirects the standard output and error messages to the file.
An additional! normally has no effect, unless there was a previous set noclobber (that is inhibited then).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies

2. Shell Programming and Scripting

>& redirection not working within csh script

I'm having a strange problem with basic >& output redirection to a simple log file in csh. When I run this particular output redirection on the command line, it works, but then when I run the same output redirection command >& in my c shell script, I get a blank log file. Nothing is output to the... (5 Replies)
Discussion started by: silencio
5 Replies

3. OS X (Apple)

When to use /Users/m/bin instead of /usr/local/bin (& whats the diff?)?

Q1. I understand that /usr/local/bin means I can install/uninstall stuff in here and have any chance of messing up my original system files or effecting any other users. I created this directory myself. But what about the directory I didn't create, namely /Users/m/bin? How is that directory... (1 Reply)
Discussion started by: michellepace
1 Replies

4. Shell Programming and Scripting

Replace & sign to &amp word

Hi, I have text file abc.txt. In this file, I have the following data. Input: Mr Smith &amp Mrs Smith Mr Smith &apos Mrs Smith Mr Smith & Mrs Smith Mr Smith& Mrs Smith Mr Smith &Mrs Smith Output: Mr Smith &amp Mrs Smith Mr Smith &apos Mrs Smith Mr Smith &amp Mrs Smith Mr Smith&amp... (4 Replies)
Discussion started by: naveed
4 Replies

5. Shell Programming and Scripting

ksh equivalent to >& in csh

In csh I am using >&. What is the equivalent in ksh?? >& - redirect stdout and stderr (csh,tcsh) (18 Replies)
Discussion started by: kristinu
18 Replies

6. Red Hat

/usr/bin/find && -exec /bin/rm never work as expected

hi there, Would you able to advise that why the syntax or statement below couldn't work as expected ? /usr/bin/find /backup -name "*tar*" -mtime +2 -exec /bin/rm -f {} \; 1> /dev/null 2>&1 In fact, I was initially located it as in crontab job, but it doesn't work at all. So, I was... (9 Replies)
Discussion started by: rauphelhunter
9 Replies

7. Shell Programming and Scripting

replace & with & xml file

Hello All I have a xml file with many sets of records like this <mytag>mydata</mytag> <tag2>data&</tag2> also same file can be like this <mytag>mydata</mytag> <tag2>data&</tag2> <tag3>data2&amp;data3</tag3> Now i can grep & and replace with &amp; for whole file but it will replace all... (4 Replies)
Discussion started by: lokaish23
4 Replies

8. Solaris

Questions about /usr/local/bin & scripts.

Hi gentlemen. For what intended is the directory /usr/local/bin? In this directory are some script. I don't understand how these scripts being in this directory are started. Each time after registration of the user occurs start of these scripts. These scripts start applications. (7 Replies)
Discussion started by: wolfgang
7 Replies

9. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

10. Shell Programming and Scripting

Using 2>&1 | tee $fout.login csh

I created this bash script. However when I tried to do it using csh, 2>&1 | tee $fout.log did not work. #!/bin/bash data=$1 inmod=$2 nxz=$3 data=` echo $data | awk 'BEGIN { FS=".dat" } { print $1 }' ` inmod=` echo $inmod | awk 'BEGIN { FS=".vmod" } { print $1 }' ` nx=`... (3 Replies)
Discussion started by: kristinu
3 Replies
Login or Register to Ask a Question