The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 1 Week Ago
Marjan Marjan is offline
Registered User
  
 

Join Date: Oct 2009
Location: Besmorth
Posts: 1
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
and this is the output

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"`
.....
Thanks for your insight

Last edited by Marjan; 1 Week Ago at 12:45 AM..
  #2 (permalink)  
Old 1 Week Ago
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,291
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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0