How to write a varible into file in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to write a varible into file in ksh
# 1  
Old 03-28-2008
How to write a varible into file in ksh

set filename $logDir/PyLog/$logname
echo $filename >> logname.txt

I am trying to write to write the varibale filename into a file logname.txt,it is not working could any one suggest y
# 2  
Old 03-28-2008
In Korn Shell, use :

Code:
filename=$logDir/PyLog/$logname

or
Code:
export filename=$logDir/PyLog/$logname

# 3  
Old 03-28-2008
Your syntax for setting the variable is wrong. Fix that, and you should be good to go.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ksh: How to write the log file simultaneously when .sql file executes by UNIX process

Hello Team- we would like to implement an approach which has to write the log file simultaneously when .sql file is executing by Unix process. At present,it is writing the log file once the process is completed. I've tested the current process with the below approaches and none of them... (1 Reply)
Discussion started by: Hima_B
1 Replies

2. UNIX for Dummies Questions & Answers

Aa_app varible in Linux

Hi, I am analyzing linux script, below is the following script line ${AA_APP:-/opt/ty/aa}/sbin/save_file_list ApplEnv.prererun ${AA_APP:-/opt/ty/aa}/sbin/ApplEnv.install_save_list I really dont understand what this line does, can someone explain me. AA_APP is variable... (4 Replies)
Discussion started by: stew
4 Replies

3. Shell Programming and Scripting

Setting Varible with AWK in KSH

I am trying to set a variable from this AWK command in KSH but I keep getting an error that says my variable cannot be found. LOADNO = $(awk -F"|" 'NR==1{print $2}' file.txt) If I just run awk -F"|" 'NR==1{print $2}' file.txt I get the right value but as soon as I try to assign this... (1 Reply)
Discussion started by: cvigeant
1 Replies

4. Shell Programming and Scripting

KSH - need to write a script to abbreviate a string

Dear Members, I have to write a UNIX script (KSH) to create a 6 letter abbreviation from a given string. The string will have alphabets and underscores only. e.g. abc_pst_xyz is our string and I have to create an abbreviation which will look like 'abpsxy' or 'abcpyz' etc. Now comes the... (8 Replies)
Discussion started by: Yoodit
8 Replies

5. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

6. Shell Programming and Scripting

How do I write a ksh script that will check if all ftp files are received?

I am trying to code a ksh script that will check to see if all 26 incoming ftp files have been received before proceeding to the next function, which is to rename each file. Here is the pseudo-code of what I am trying to do: <<STEP_1>> IF all ALS files have been transmitted then... (2 Replies)
Discussion started by: doug145
2 Replies

7. Shell Programming and Scripting

Can ls in ksh write to output?

I have a ksh script written by someone... now i am trying to modify it to my requirement.... Its executed like this Read.ksh load ${CUR_MAINT_DATE} if then filnam="Load_CLM" else filnam="${1}" fi if then CUR_MAINT_DATE="${2}" fi if then ls... (1 Reply)
Discussion started by: bhagya2340
1 Replies

8. UNIX for Dummies Questions & Answers

Is this a varible type?

Wondering what $@ does - is it a variable of some kind? (1 Reply)
Discussion started by: Jayden
1 Replies

9. Shell Programming and Scripting

Space in varible?

Hey guys I have here what I am sure amounts to a pretty dumb question.... how do I assign a value of say 999 to a variable called "random number" (note the space between random and number). What would the script look like using borne shell? Thanks! :) (4 Replies)
Discussion started by: pattingtonjbear
4 Replies

10. Shell Programming and Scripting

Using varible/varible substitution in Perl/sed Search & Replace

Hi, I have a program that searches for a particular string patten. I am however having difficulty passing the varible $i (in a loop) as the string pattern to replace. Using either perl or sed search and replace statements, I get the same kinda result. For example, using the perl: for i in... (3 Replies)
Discussion started by: Breen
3 Replies
Login or Register to Ask a Question