Jump to content


Photo

Bash / SH script help


  • Please log in to reply
2 replies to this topic

#1 mikem1034

mikem1034

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 12 February 2013 - 03:17 PM

Hi!

I need to create a script that will create a file and dump formatted text into it. I need to run the script with an argument which will be the filename.

#!/bin/sh
echo "Hello world" > ../directory/$arg1.txt

I need the text added to the file to be like:
class Arg1 {
public function x() {
....
}
}

Can anybody help me create a script to do this?

#2 trq

trq

    Advanced Member

  • Administrators
  • 30,723 posts
  • LocationSydney, Australia.

Posted 13 February 2013 - 05:13 AM

How about you try and write it and come back when you have a specific issue?

The example you posted really isn't that far off.

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#3 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,250 posts
  • LocationMississauga, Canada

Posted 14 February 2013 - 09:21 AM

How did you solve the issue?

I know how to do this, but the principle of that forum is to share solutions to each other.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com