Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> Writing a Script with requirements
bubbawoo
post Jul 23 2017, 05:09 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 23-July 17
Member No.: 19,832



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 "getQuote.sh" (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:

#!/bin/bash

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

Please help!!!
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies
michaelk
post Jul 24 2017, 05:29 AM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,800
Joined: 23-January 03
Member No.: 360



~/.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.
tldp.org/LDP/Bash-Beginners-Guide/html/chap_07.html
tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 12th December 2017 - 11:15 AM