LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 06-03-2020, 05:37 AM   #1
Sadshark
LQ Newbie
 
Registered: Jun 2020
Posts: 16

Rep: Reputation: Disabled
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
 
Old 06-03-2020, 11:19 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
opening a video is something like: vlc <path>

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?
 
Old 06-03-2020, 06:52 PM   #3
Sadshark
LQ Newbie
 
Registered: Jun 2020
Posts: 16

Original Poster
Rep: Reputation: Disabled
@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

Last edited by Sadshark; 06-03-2020 at 06:55 PM.
 
Old 06-03-2020, 07:15 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by Sadshark View Post

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.
 
1 members found this post helpful.
Old 06-08-2020, 04:59 AM   #5
Sadshark
LQ Newbie
 
Registered: Jun 2020
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
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.
 
  


Reply



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
make install fills generates loads of MB bucovaina78 Linux - Software 5 07-09-2012 07:56 PM
Simple bash script generates error hal8000b Programming 2 07-01-2010 06:43 AM
sql output generates on a os text file ! shipon_97 Linux - General 0 01-14-2009 05:46 AM
"make" always generates errors, regardless of program install attempted: Ubuntu 8.04 computer_freak_8 Linux - Software 9 07-17-2008 03:56 PM
How to parse text file to a set text column width and output to new text file? jsstevenson Programming 12 04-23-2008 02:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:35 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration