Csh , how to set var value into new var, in short string concatenation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Csh , how to set var value into new var, in short string concatenation
# 1  
Old 06-30-2014
Csh , how to set var value into new var, in short string concatenation

i try to find way to make string concatenation in csh ( sorry this is what i have )
so i found out i can't do :

Code:
set string_buff = ""

foreach line("`cat $source_dir/$f`")

$string_buff  = string_buff $line 

end

how can i do string concatenation?
# 2  
Old 06-30-2014
Refer to (=read) $var but set (=write) var.
And better no spaces around the = in an assignment. Also csh needs set in an assignment.
Code:
set string_buff=""
foreach line ("`cat $source_dir/$f`")
  set string_buff="$string_buff $line"
end

In this simple case the following seems identical
Code:
set string_buff="`cat $source_dir/$f`"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog

I have been searching and reading about syslog. I would like to know how to Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog. tail -f /var/log/messages dblogger: msg_to_dbrow: no logtype using missing dblogger: msg_to_dbrow_str: val ==... (2 Replies)
Discussion started by: kenshinhimura
2 Replies

2. Windows & DOS: Issues & Discussions

How to automatically set the DISPLAY var?

Hi all, Our users use Putty on Windows servers to log on to UNIX via SSH and run GUI applications. Is there a way to automatically get the display numbers from xming or Exceed (that are running on Windows) to set the DISPLAY var properly on UNIX? X11 forwarding is not an option. The closest I... (3 Replies)
Discussion started by: ejianu
3 Replies

3. Solaris

Difference between /var/log/syslog and /var/adm/messages

Hi, Is the contents in /var/log/syslog and /var/adm/messages are same?? Regards (3 Replies)
Discussion started by: vks47
3 Replies

4. Shell Programming and Scripting

assign var with set=a[5] not working

Hi Experts, I'm having issue in assigning var with special character , please see below for complete details. $ echo $SHELL /bin/csh $ cat bp abd/asd/a $ awk -F "/" '{print $NF}' bp | awk '{print $1}' a $ set a=`awk -F "/" '{print $NF}' bp | awk '{print $1}'` $ echo $a ... (15 Replies)
Discussion started by: novice_man
15 Replies

5. Solaris

/var/adm & /var/sadm

what is the difference between tha /var/adm and /var/sadm files in solaris 10 Os please can any one respond quickly thanking you (2 Replies)
Discussion started by: wkbn86
2 Replies

6. Solaris

Lost /var/sadm/install/contents file and /var/sadm/pkg

Hello, I recently found that my /var/sadm/install/contents, ~/admin/default, /var/spool/patch and /var/spool/pkg files were empty. This broke the pkginfo, pkgchk and other package related tools. The pkgmap no longer points to where the applications have been installed. I have replaced the... (0 Replies)
Discussion started by: ronin42
0 Replies

7. UNIX for Dummies Questions & Answers

Check to see if string var is empty

i have a veriable set var1 set var2 = abcd how can i check if var 1 is empty and if var 2 is not empty ??? (2 Replies)
Discussion started by: nirnir26
2 Replies

8. Shell Programming and Scripting

How to use shell var for pattern string at KSH

Hi there, In the following test, how to use shell var for pattern, regular expression. I need to accept pattern at argument, use it to pattern matching at shell script. Test: #!/bin/ksh # name t.sh exp="a@(a|b)" touch aa ab ac echo "\nTest without variable" echo "---------------------"... (2 Replies)
Discussion started by: tkang007
2 Replies

9. Solaris

diff b/w /var/log/syslog and /var/adm/messages

hi sirs can u tell the difference between /var/log/syslogs and /var/adm/messages in my working place i am having two servers. in one servers messages file is empty and syslog file is going on increasing.. and in another servers message file is going on increasing but syslog file is... (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

10. Shell Programming and Scripting

Difference between "set $<var>" and "set -- $<var>"

Hi pros, Could anyone tell me the actual difference between setting the positional parameters from the variable using the following commands? $ var="This is my question" $ set $var $ echo $1 --> 'This' $ echo $2 --> 'is' .... .... and $ var="This is my question" $ set --... (3 Replies)
Discussion started by: royalibrahim
3 Replies
Login or Register to Ask a Question