[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 110: Undefined array key "cached"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 111: Undefined array key "normal"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 112: Undefined array key "total"
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3391: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3393: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3394: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3395: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
Cabrillo College Linux Classes • View topic - acceptable scripts/commands from where ever?
Page 1 of 1

acceptable scripts/commands from where ever?

PostPosted: Thu Nov 28, 2013 8:20 pm
by Marc Caudill
I wanted to give user interaction that actually gave a choice rather than use a "dummy" value. So I came accross the if..then..else..fi thing at [url]http://bash.cyberciti.biz/guide/If..else..fi[/url] among other places. If I use this something like:
[code]if test var -eq val
then
command executed successfully
execute all commands up to else statement
or to fi if there is no else statement

else
if command failed then
execute all commands up to fi
fi[/code]

Or
[code]##!/bin/bash
read -p "Enter a password" pass
if test "$pass" = "jerry"
then
echo "Password verified."
else
echo "Access denied."
fi[/code]

Would that account for "has user interaction" or more along the lines of:

No credit for any task which contains unoriginal script code that:

Doesn’t give full credit to the original author

Doesn’t indicate where the code was obtained from

Doesn’t include licensing terms

Violates copyright or licensing terms


Also I wanted an infinite loop so I used:
while :
do
done

Is this somethig that I have to give credit to the author?

Re: acceptable scripts/commands from where ever?

PostPosted: Fri Nov 29, 2013 12:40 pm
by Rich Simms
To be interactive you just need to prompt the user and read what they type. One of the five point grading rubric options is to use an "if statement" (called a conditional) in your script. There is no need to credit anyone if you are just using their example to learn the syntax for an if statement or while loop.

If you want to peek at what we cover next week you can view Lesson 14 from previous terms on the website. That lesson has a number of examples of how to use if statements, color and other tips.

Happy scripting!

- Rich