Shell script file handling


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script file handling
# 1  
Old 03-26-2008
Shell script file handling

Hi

! /bin/sh

set logdir1 "logDir/local/logname"
#write the filename into a file
echo $logdir1 >> logname.txt

how do i exec the above echo command
# 2  
Old 03-26-2008
You're probably trying to do something like this:

#!/bin/sh
logdir1="logDir/local/logname"

# are you trying to append?
# otherwise you can use '>' instead of '>>'
ls $logdir >> logname.txt
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue handling single quoted argument in shell script.

Below is my script that works fine and prints the desired output: #!/bin/ksh echo "$1" | while IFS= read -r dirpath do echo "DIRR_PATH:$dirpath" install_dir=$install_dir" "$dirpath done echo "Desired Output:$install_dir" Output: ./loopissue.sh... (10 Replies)
Discussion started by: mohtashims
10 Replies

2. Shell Programming and Scripting

Help with shell script handling processes

Hello I have a file which has around 120 lines of commands. I am trying to write a shell script like which reads the 'command' file and executes line by line with some additional (common argument) with maximum 6 commands active at a time. Each of these commands when executed takes time... (5 Replies)
Discussion started by: JackyShane_36
5 Replies

3. Shell Programming and Scripting

Help with Handling multiple argument in shell script

Hi i have written a shell script that takes only single ip address from the user and calculates its latency and reliability, can you please tell me that what should be done if i want that user should enter 100 or 1000 ip address (5 Replies)
Discussion started by: Preeti_17
5 Replies

4. UNIX for Dummies Questions & Answers

File not found handling in ftp script

I have a pattern for filename to be searched. I need to get the files from remote server Who are matching the file pattern. And i need to exit with non zero return code for: 1)No files found matching that pattern 2)More than one files matching the name pattern. If only one files is... (1 Reply)
Discussion started by: pandeesh
1 Replies

5. UNIX for Dummies Questions & Answers

File handling in bash shell scripting

i am new to shell scripting and stuck at one place in my program. i am reading data from one structured file and extracting some data from particular lines and then writing into the output file. In that reading input file line by line from while loop. while read line do rectype=line... (7 Replies)
Discussion started by: reeta_shri
7 Replies

6. Shell Programming and Scripting

Interrupt handling in k shell

Hi All, Is interrupt handling possible in k shell? Say if the user press CTRL-C or CTRl-D,I want to perform a particular action before terminating? Thnaks! (2 Replies)
Discussion started by: prasperl
2 Replies

7. Shell Programming and Scripting

File handling with bash shell scripting

Hi all, Can anyone guide to get tricks for file handling in bash shell? Thanks in advance. Thanks Deepak (2 Replies)
Discussion started by: naw_deepak
2 Replies

8. Shell Programming and Scripting

File handling in Script

Hi All, How can we handle file operation in scripts. I have written a script that run ok otherwise however the "Cat" operation leaves a process open on the box. Command is like cat "${LASTFILENAME}" | /usr/xpg4/bin/awk -F, '{do{if ($3 == "100" && $4 == "300" && $170 ~ /^abc/) { ... (2 Replies)
Discussion started by: raman1605
2 Replies

9. Shell Programming and Scripting

Exception-handling in Shell programs

Hi all, I am writing a set of scripts and some of these are nested within others. I want to be able to execute a single high-level script at the command-line, which in turn may invoke other scripts as required, and when a failure occurs in any of the nested scripts, I want to be able to track... (2 Replies)
Discussion started by: chaitu_inmage
2 Replies

10. UNIX for Advanced & Expert Users

signal handling in shell script

Hi can any please tell me is it possible to catch the signal in a shell script like we do in C. if yes please give me some idea or a link. (4 Replies)
Discussion started by: Raom
4 Replies
Login or Register to Ask a Question