LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-15-2002, 01:33 AM   #1
meng_en
LQ Newbie
 
Registered: Sep 2002
Posts: 12

Rep: Reputation: 0
how to convert a text file into shell script


HI,
may i know is there a way or what codes to use to convert a text file into a shell script?


Thanks in advance
 
Old 10-15-2002, 02:01 AM   #2
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
If the text file is already written to be a shell script, then all you need to do is chmod it to execute:
chmod 755 (or for everyone on earth to be able to execute,read, and write to it 777) filename

And then to execute it:
./filename OR
/path/to/file/filename

Cool
 
Old 10-15-2002, 03:42 AM   #3
meng_en
LQ Newbie
 
Registered: Sep 2002
Posts: 12

Original Poster
Rep: Reputation: 0
MasterC Thanks for ur reply,
but the text file has not write into a shell script.I think u mistaken wat i want to do.Im creating a shell script(bourne shell) to convert the text files example test.txt into a shell script like test.sh and i want to know is there there a way or codes to be added into the shell script i created to do the conversion.

Pardon me for not explainin myself clearly !

Thanks in advance

Last edited by meng_en; 10-15-2002 at 03:44 AM.
 
Old 10-15-2002, 09:37 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
sorry, this is gibberish.. how do you expect to "convert" plain text into a working script???? that doesn't even nearly make sense.

get a book.
learn bash.
 
Old 10-15-2002, 10:57 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,968

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
shell scripts

Your question is vague. An example would help to clarify.
What do you want to convert?


Last edited by michaelk; 10-15-2002 at 10:58 AM.
 
Old 10-15-2002, 11:08 AM   #6
Smitty-rh
Member
 
Registered: Oct 2002
Distribution: Redhat
Posts: 35

Rep: Reputation: 15
#

Last edited by Smitty-rh; 10-15-2002 at 11:28 AM.
 
Old 10-15-2002, 11:12 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
Quote:
Originally posted by Smitty-rh
chmod +x /path/to/filename
can i just ask why you have posted this when it is already clear that this is not what they are after? please make sure you understand the question you are replying to in future, thnaks.
 
Old 10-15-2002, 12:34 PM   #8
therion12
Member
 
Registered: Dec 2001
Location: chicago, IL
Distribution: Gentoo 1.4_rc1
Posts: 913

Rep: Reputation: 30
You just need to add this as the first line of your bash script:

#!/bin/bash (or whatever you prefer, sh for example works too)

Then you can write your own scripts for compiling kernels, etc. Can be used for loads of things.
 
Old 10-15-2002, 08:39 PM   #9
meng_en
LQ Newbie
 
Registered: Sep 2002
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks all for your reply,
i greatly appreciate ur help.I will try my way to find the solution....Thanks anyway
 
Old 10-15-2002, 10:46 PM   #10
purpleburple
Member
 
Registered: Jun 2002
Location: USA
Distribution: Slackware8.1
Posts: 332

Rep: Reputation: 30
I got 'Learning the Bash Shell' by O'Reily. Really is a great book.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find and change a specific text in a text file by using shell script Bassam Programming 1 07-18-2005 07:15 PM
Search and replace text in file using shell script? matthurne Linux - Software 2 11-02-2004 10:11 AM
Shell script - how to show a specific line of a text file davi_cabral Linux - Software 3 09-28-2004 01:39 PM
Convert from shell script to binary? Anon123 Linux - General 4 06-26-2004 05:53 AM
How to delete a line from a text file with shell script programming Bassam General 1 01-28-2004 08:51 PM


All times are GMT -5. The time now is 07:43 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration