It's UWAweek 26 (mid-year break)

helpOSTS

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

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 439 articles.
Currently 9 other people reading this forum.


 UWA week 13 (1st semester, week 5) ↓
SVG not supported

Login to reply

👍?
helpful
lab4   (both)
9:54pm Tue 26th Mar, Suan C.

Hi Michael, I extracted the below codes from lab4 and have put down the queries below (after long ______). Apologies as I am still figuring out how to use more interactive editing style (at least with some colors?).

#!/bin/bash

get file name from command line

check if file exists

if file doesn't exist, print error message

if [[ ! -f $1 ]] ______ why we put $1 here? $1 is the first argument? or what are we referring to? can we put $0? then 1>&2 echo ERROR ______ what does &2 here mean? exit 1 else # if file exists, print 3rd line head -n 3 $1 | tail -n 1 fi

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  5:07AM Sep 06 2023
Privacy policy