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).

A reminder that there will be no Zoom laboratory session on Friday 29th.
 
Assignment 2 and Clarifications.
 
Options:
RSS cloud
Jump to:

Store a variable to indicate a filename

1 of 339 articles shown, currently no other people reading this forum.
photo
From: Christopher M.
Date: Mon 30th Mar, 2:18pm
Actions: 
        Login-to-reply
"Wei Liew"                               wrote:

> Hi Chris, 
> 
> How to create a shellscript that will ask for filename to compare with dictionary?
> 
> I was able to create a shellscript to do character reduction but not for comparing 
> files as I was not familiar on how to store filename as variable. 

Hello,

When someone else asked this same question, I added the following to the Exercise sheet:

  Inside your shellscript (file), you can access the provided command-line argument using 
the value of $1.

Sorry, but you may not have seen that if you hadn't refreshed your browser.

In fact, we can pass multiple command-line arguments to a shellscript, perhaps multiple 
filenames,  and then access each argument with $1, $2, $3, ...

Hope that helps.

Related articles

Store a variable to indicate a filename (both) RSS
├─ original   Thu 26th Mar, 9:29pm, Wei L.
└─ THIS   Mon 30th Mar, 2:18pm, Christopher M.
This Page


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