4 Replies - 1553 Views - Last Post: 25 April 2011 - 03:02 PM Rate Topic: -----

#1 Charlie IronGleet  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 225
  • Joined: 29-January 09

Execute a script from within a script - Bash Shell

Posted 25 April 2011 - 02:44 PM

Hi,

How do I execute an awk script from within a bash script? I want to execute the script against a particular file. So I know you can just go if whatever then ./yourScript. What I need to know is how to tell that script what file to process.

Thanks,
Charlie

View PostCharlie IronGleet, on 25 April 2011 - 03:40 PM, said:

Hi,

How do I execute an awk script from within a bash script? I want to execute the script against a particular file. So I know you can just go if whatever then ./yourScript. What I need to know is how to tell that script what file to process.

Thanks,
Charlie


BTW: Please accept my apologies if I've posted in the wrong forum. Unless I overlooked it, I didn't see a Linux or shell scripting forum.

Is This A Good Question/Topic? 0
  • +

Replies To: Execute a script from within a script - Bash Shell

#2 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5178
  • View blog
  • Posts: 26,870
  • Joined: 10-May 07

Re: Execute a script from within a script - Bash Shell

Posted 25 April 2011 - 02:45 PM

Is your awk script set to executable?
Was This Post Helpful? 0
  • +
  • -

#3 Charlie IronGleet  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 225
  • Joined: 29-January 09

Re: Execute a script from within a script - Bash Shell

Posted 25 April 2011 - 02:50 PM

View Postno2pencil, on 25 April 2011 - 03:45 PM, said:

Is your awk script set to executable?


yes
chmod 755 script
Was This Post Helpful? 0
  • +
  • -

#4 Charlie IronGleet  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 225
  • Joined: 29-January 09

Re: Execute a script from within a script - Bash Shell

Posted 25 April 2011 - 02:56 PM

View PostCharlie IronGleet, on 25 April 2011 - 03:50 PM, said:

View Postno2pencil, on 25 April 2011 - 03:45 PM, said:

Is your awk script set to executable?


yes
chmod 755 script


What I mean is like this: I might go .. less script. That's analogous to what I want to do here. Is there anyway I can go ./RecScript script.... or equivalent.
Was This Post Helpful? 0
  • +
  • -

#5 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5178
  • View blog
  • Posts: 26,870
  • Joined: 10-May 07

Re: Execute a script from within a script - Bash Shell

Posted 25 April 2011 - 03:02 PM

You should be able to just launch a shell with sh.

#!/bin/sh
script="awk.sh"

#launch script
sh $script

#report results
var=`sh $script`
echo ${var}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1