[SOLVED] Want to make a script that generates a welcome file with text inside it
Linux - GeneralThis 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.
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.
Want to make a script that generates a welcome file with text inside it
Hi all. I wanted to ask you guys a few questions about my first ever script I've made. The idea came to me today when I was building a custom linux distro (its ready and released now--don't worry, Im not here to fight that distro battle with folks). I found out a way to do it "Cheaply" i.e. without fancy tricks, just opening files from a an executable script, but I want to figure out how to do it the "cool" way, kapische? :P
So my idea was this:
I wanted to make an executable welcome file for my distro that
1. Opens a video
2. Generates a file with text inside it i.e. "welcome to my distro" on the desktop
The idea seemed so simple to me at first but I really blew my own mind trying to figure it out online. It's a lot more complicated than it sounds apparently. Anyways, does anybody know how I might go about doing this? Thanks
Exactly when did you want to play that video? after boot or login (or any other event?)
When did you want to put that text file onto the desktop? Will it change or is it a single action?
@Pan64 first off I wanted to say I genuinely appreciate your reply.
Secondly, I feel like I didnt explain myself correctly, so I want to reword what I said. So I want the script to:
1. open a video (in VLC like you said actually)
2. ideally, I'd like to do this next commands while the intro video is still playing, but I'm also okay with the next command running after the user closes the intro video.
3. next command would be like "touch welcome to (my distro)" on my desktop directory AND also write the welcome paragraph I want to that new file 'in the background while VLC is running (or after is fine too)
4. Open the welcome file in kate (thats the easy part)
so with that being said I hope I'm being a bit more descriptive now :]
edit: oh and I dont want the script to run automatically. I want people to open it after noticing it when opening their file browser for the first time. basically like a nifty little trick I want to perform here, at the end of day. lol
The idea seemed so simple to me at first but I really blew my own mind trying to figure it out online. It's a lot more complicated than it sounds apparently. Anyways, does anybody know how I might go about doing this? Thanks
Without knowing what your difficulties are, it's hard to advise. Does this help?
Code:
vlc video.mp4
echo Welcome > $HOME/Desktop/welcome.txt
kate $HOME/Desktop/welcome.txt
If you want to do things while the video is playing, add an "&" to the vlc line.
If you want to do certain things while the video is playing, and other things when the video is complete, it's slightly more complex (but by no means hard). I'd first get the simple case working, then increase complexity.
Last edited by berndbausch; 06-03-2020 at 07:17 PM.
Without knowing what your difficulties are, it's hard to advise. Does this help?
Code:
vlc video.mp4
echo Welcome > $HOME/Desktop/welcome.txt
kate $HOME/Desktop/welcome.txt
If you want to do things while the video is playing, add an "&" to the vlc line.
If you want to do certain things while the video is playing, and other things when the video is complete, it's slightly more complex (but by no means hard). I'd first get the simple case working, then increase complexity.
That works perfectly! Thanks so much. One thing I can offer that may help newbies is if you want to control the spacing and the line seperation of the file, put ' marks at either end of the text you wanna add, then type it in the script exactly like you want it to come out like.
example:
echo 'blah blah blah
blah blah blah
blah blah blah'
If you dont use the ' marks the script will get confused and not write anything to the file, lol.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.