![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to write script that behaves both in interactive and non interactive mode | rits | Homework & Coursework Questions | 8 | 08-17-2009 11:47 PM |
| Help with Interactive / Non Interactive Shell script | rits | Homework & Coursework Questions | 1 | 08-16-2009 04:39 PM |
| Automating Interactive script | soupbone38 | Shell Programming and Scripting | 7 | 04-21-2009 03:09 AM |
| script to non interactive mode | swetham.apps | Shell Programming and Scripting | 1 | 03-03-2009 05:26 PM |
| script to performm interactive ftp | prash_b | SUN Solaris | 1 | 05-09-2006 08:21 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Interactive script
Greetings gurus
I have this simple scripts Code:
#!/bin/bash
find /kl1/CTT/TQI_001/330_spike/sz00/latcon1/ -type d -name "*.dig" > data_schema
find /kl1/CTT/TQI_001/330_spike/sz00/latcon1/ -type d -name "*.dig" >> data_schema
<data.schema awk '{print NR, "inVol=" $0, "setDt=4000", "ebcdicHdr=/kl1/CTT/TQI_001/410_segy/130header/"}' > data.schema
1 inVol=/kl1/CTT/TQI_001/330_spike/sz00/latcon1/stackmuted.dig setDt=4000 ebcdicHdr=/kl1/CTT/TQI_001/410_segy/130header/ 2 inVol=/kl1/CTT/TQI_001/330_spike/sz00/latcon1/stack_pimpmuted.dig setDt=4000 ebcdicHdr=/kl1/CTT/TQI_001/410_segy/130header/ 3 inVol=/kl1/CTT/TQI_001/330_spike/sz00/latcon1/stack_simp_muted.dig setDt=4000 ebcdicHdr=/kl1/CTT/TQI_001/410_segy/130header/ 4 inVol=/kl1/CTT/TQI_001/330_spike/sz00/latcon1/stack_rmuted.dig setDt=4000 ebcdicHdr=/kl1/CTT/TQI_001/410_segy/130header Is there anyway I can make it interactive so I can just put directory and desired variable DT w/out editing the script manually everytime? Somehow like this Code:
echo "Enter the directory name" read src echo "Enter DT variable if any" read DT for file in `find $src name "*.dig"` ..... Last edited by Marjan; 1 Week Ago at 12:45 AM.. |
|
||||
|
Not sure about it, but is this what you're looking for?
Code:
#!/bin/bash
echo -n "Enter the directory name: "
read src
echo -n "Enter DT variable if any: "
read DT
for file in `find $src -type d -name "*.dig"`
do
awk -v f="$file" -v d="$DT" '
{print NR, "inVol=" $0, "setDt=" d, "ebcdicHdr=" f}' > data.schema
done
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|