Faculty of Engineering and Mathematical Sciences 
Not logged in (login)

help4407


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting (CITS4407).

Assignment 2 and Clarifications.
 
Options:
RSS cloud
Jump to:

assignment 2 q2

1 of 390 articles shown, currently no other people reading this forum.
photo
From: Christopher M.
Date: Thu 21st May, 7:52am
Actions: 
        Login-to-reply
"Jordan Makins"                               wrote:

> Do you have a preference on whether our shellscript takes the text file url as an argument 
> when run from the command line or would you prefer its url pasted in and downloaded within 
> the script? 

Hi Jordan,

It's always preferred to have a more general script, one that can process different inputs (without 
having to change the script itself - which is actually much easier with a scripting approach, than a 
compiled approach).  So, yes, use of a command-line argument is preferred.

But it's simple to support both by checking if an argument was provided:

if [ $# == "0" ]
then
    inputfile="default-input-file"
else
    inputfile="$1"
fi

Related articles

Assignment 2, Q2 (all 13) RSS
├─ original   Thu 14th May, 3:10pm, Mingbo Z.
├─ reply 1   Thu 14th May, 3:48pm, Christopher M.
├─ reply 2   Fri 15th May, 2:25am, Thanh T.
├─ reply 3   Fri 15th May, 3:55am, Christopher M.
├─ reply 4   Fri 15th May, 12:32pm, Thanh T.
├─ reply 5   Fri 15th May, 4:31pm, Mingbo Z.  O.P.
├─ reply 6   Fri 15th May, 5:04pm, Mingbo Z.  O.P.
├─ reply 7   Fri 15th May, 5:17pm, Christopher M.
├─ reply 8   Fri 15th May, 5:19pm, Christopher M.
├─ reply 9   Fri 15th May, 5:54pm, Mingbo Z.  O.P.
├─ reply 10   Fri 15th May, 6:04pm, Christopher M.
├─ reply 11   Wed 20th May, 3:33pm, Jordan M.
└─ THIS   Thu 21st May, 7:52am, Christopher M.
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  8:27am May 24 2020