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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-15-2002, 02:33 AM
|
#1
|
LQ Newbie
Registered: Sep 2002
Posts: 12
Rep:
|
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
|
|
|
10-15-2002, 03:01 AM
|
#2
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
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
|
|
|
10-15-2002, 04:42 AM
|
#3
|
LQ Newbie
Registered: Sep 2002
Posts: 12
Original Poster
Rep:
|
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 04:44 AM.
|
|
|
10-15-2002, 10:37 AM
|
#4
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
10-15-2002, 11:57 AM
|
#5
|
Moderator
Registered: Aug 2002
Posts: 26,540
|
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 11:58 AM.
|
|
|
10-15-2002, 12:08 PM
|
#6
|
Member
Registered: Oct 2002
Distribution: Redhat
Posts: 35
Rep:
|
#
Last edited by Smitty-rh; 10-15-2002 at 12:28 PM.
|
|
|
10-15-2002, 12:12 PM
|
#7
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
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.
|
|
|
10-15-2002, 01:34 PM
|
#8
|
Member
Registered: Dec 2001
Location: chicago, IL
Distribution: Gentoo 1.4_rc1
Posts: 913
Rep:
|
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.
|
|
|
10-15-2002, 09:39 PM
|
#9
|
LQ Newbie
Registered: Sep 2002
Posts: 12
Original Poster
Rep:
|
Thanks all for your reply,
i greatly appreciate ur help.I will try my way to find the solution....Thanks anyway
|
|
|
10-15-2002, 11:46 PM
|
#10
|
Member
Registered: Jun 2002
Location: USA
Distribution: Slackware8.1
Posts: 332
Rep:
|
I got 'Learning the Bash Shell' by O'Reily. Really is a great book.
|
|
|
All times are GMT -5. The time now is 11:46 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|