Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
I have added a file named "journal-file to my home directory, and have typed this script into my terminal on my virtual machine, nothing happens. what do I have to do to get this script to execute?
$ cat journal
# journal: add journal entries to the file
# $HOME/journal-file
file=$HOME/journal-file
date >> $file
echo -n "Enter name of person or group:"
read name
echo "$name" >> $file
echo >> $file
cat >> $file
echo "------------------------------------" >> $file
echo >> $file
Put #!/bin/bash at the top of the script, as it designates what is used to interpret. Also, run the chmod +x journal command from the terminal while in the "home" directory (wherever the script is saved).
On the command line! Again, you use chmod to change the permissions on the script (i.e. who can read, write and execute it). By that logic, it doesn't make sense to put it inside the script.
Sorry for all the questions but I'm just a little lost and I'm trying to figure this out.
It is used as a command at the command prompt. The command prompt is displayed by the shell (usually bash) in a terminal. Which desktop are you using? Could be Gnome, KDE, Unity ... Details of how to start a terminal depend on the desktop.
On the command line! Again, you use chmod to change the permissions on the script (i.e. who can read, write and execute it). By that logic, it doesn't make sense to put it inside the script.
$ cat journal
# journal: add journal entries to the file
# $HOME/journal-file
file=$HOME/journal-file
date >> $file
echo -n "Enter name of person or group:"
read name
echo "$name" >> $file
echo >> $file
cat >> $file
echo "----------------------------------------------------" >> $file
echo >> $file
In this script, the only command line is the very first line, all the rest are script? is this correct?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.