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


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

Store a variable to indicate a filename

1 of 390 articles shown, currently no other people reading this forum.
From: Christopher M.
Date: Mon 30th Mar 2020, 2:18pm


"Wei Liew" <22*1*2*[email protected]*u*e*t*u*a*e*u*a*> 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. 


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 2020, 9:29pm, Wei L.
└─ THIS   Mon 30th Mar 2020, 2:18pm, Christopher M.
This Page

Program written by: [email protected]
Feedback welcome
Last modified: 11:27am Sep 21 2020