Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ Writing a Script with requirements

Posted by: bubbawoo Jul 23 2017, 05:09 PM

I am VERY new to Linux and am trying to do this extra credit for a class. I have tried researching and there is so much information, I am just not sure how to make this work. This is what I have been tasked to do:

You will need to write a script named "" (must be executable) that meets the following requirements:

1. Check if the file "quote1" exists in your home directory.
2. If the file "quote1" does not exist in your home directory, copy it from "/some/crazy/file" to your home directory.
3. Print the contents of the file "~/quote1" to the screen.
4. Compress the file "~/quote1" using the gzip utility AFTER requirement 3.

I have tried entering the following lines for the script, but it doesn't work:


if [ -f ~/.quote1 ]; then
cp ~/.quote1 ~/.quote1.old
ls -alh ~/.quote*
gzip ~/quote1

Please help!!!

Posted by: michaelk Jul 24 2017, 05:29 AM

~/.quote1 I do not know if the . in the file name is a typo but in this context it means hidden which I doubt is what you want.

This is your assignment and not ours so we are not going to write it for you. I/we will answer specific questions. These guides should hellp a bit.

Posted by: bubbawoo Jul 24 2017, 10:08 AM

Thank you for the response. I did not presume that anyone would write the assignment for me, but simply asked for guidance, since there is so much information out there. Linux is definitely not beginner friendly and it is difficult to find the right information when there is so much of it and you have no idea what to look for. Again, thanks for the information. I will take a look at it and hope for the best.

Powered by Invision Power Board (
© Invision Power Services (