105.2 Let's Learn Linux: Customize or write simple scripts — Lesson 2

Livestream date: 2026-06-07

Weight 4

Key knowledge areas

  • Use standard sh syntax (loops, tests).
  • Use command substitution.
  • Test return values for success or failure or other information provided by a command.
  • Execute chained commands.
  • Perform conditional mailing to the superuser.
  • Correctly select the script interpreter through the shebang (#!) line.
  • Manage the location, ownership, execution and suid-rights of scripts.

Homework 1

How could all of the script’s command line arguments be used to initialize a Bash array?

Homework 2

Why is it that, counter intuitively, the command test 1 > 2 evaluates as true?

Homework 3

How would a user temporarily change the default field separator to the newline character only,
while still being able to revert it to its original content?

  1. dont know XD i gues array = ($1, $2, $3, etc)
  2. becuse your missing the () to make it an arithmetic comparison but why is it true not sure.
  3. IFS=‘\n’ i think so it would seperate only on newline and sens you want it temporary just type IFS=‘.’ to revert it

Well, that will work but what if you have more arguments?

There’s a way to specify them all at once.

That will make . a separator which is not what you want. How can we restore the previous value of IFS?

  1. think we can do array = ( $@) so it will use all arguments even if we dont designate the amount of arguments

  2. unset IFS then bash will start spliting as default

Yep, just a tiny little improvement: use quotes around $@ so that arguments with spaces work as expected.

But the answer is correct.

True.

You could also save previous IFS value to a variable and restore it afterwards.