[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 - X1 Question 6

X1 Question 6

Introduction to UNIX/Linux

X1 Question 6

Postby Charles Stanley on Tue Dec 16, 2008 2:31 pm

Hi, I'm out here at the CIS lab working on the extra credit lab and have been make good progress until I got stuck on this. I have tried redirection and piping but can not for the life of me get it to work any help would be great.

Thanks,

Charles
Charles Stanley
 
Posts: 15
Joined: Wed Sep 10, 2008 5:59 pm

Re: X1 Question 6

Postby Robert Lyons on Tue Dec 16, 2008 10:32 pm

Try this :

banner "$(date)" > today
User avatar
Robert Lyons
 
Posts: 20
Joined: Wed Sep 03, 2008 7:30 pm

Re: X1 Question 6

Postby alexa bolas on Tue Dec 16, 2008 11:09 pm

Ok. I did try the [i]banner $date[/i] then [i]banner "$date"[/i]
Why does it work [i]banner "$(date)" > today[/i] with the parathesis?
forgetting what the () do.
alexa bolas
 
Posts: 30
Joined: Wed Sep 03, 2008 7:28 pm

Re: X1 Question 6

Postby Nicholas Gardner on Tue Dec 16, 2008 11:35 pm

I also tried banner $date and "$date" with no luck. I think the parenthesis make the date command read like a variable instead of a command, if that makes any sense. I could be completely wrong, but either way thanks for posting the solution.
Nicholas Gardner
 
Posts: 23
Joined: Wed Sep 03, 2008 7:27 pm

Re: X1 Question 6

Postby chithra mohanavelu on Tue Dec 16, 2008 11:38 pm

try this
banner `date` > today
chithra mohanavelu
 
Posts: 21
Joined: Wed Sep 03, 2008 7:27 pm

Re: X1 Question 6

Postby Nicholas Gardner on Tue Dec 16, 2008 11:55 pm

I think[i] banner `date` > today[/i] is what Rich is looking for. I don't fully understand how the banner command works but using `date` puts each part of the date command's output on a new line where as [i]"$(date)"[/i] just reads the first part of the date, cutting off the rest as if the date was "echoed" in. Thanks for the quick response Chithra :D .
Nicholas Gardner
 
Posts: 23
Joined: Wed Sep 03, 2008 7:27 pm

Re: X1 Question 6

Postby Jonathan Simms on Wed Dec 17, 2008 1:40 am

Hi,

You can used either banner $(date) or banner `date` because both are valid forms of command substitution although remember that `date` is deprecated in favor of $(date) but either works. So the correct syntax would be [code]$ banner $(date) > today or $ banner `date` > today[/code] but remember that the banner command sees the output of the date command because during command substitution the shell first executes the date command as a sub-shell which passes the output of the date command to banner.
Jonathan Simms
 
Posts: 119
Joined: Tue Sep 02, 2008 7:11 pm

Re: X1 Question 6

Postby chithra mohanavelu on Wed Dec 17, 2008 8:43 am

Hi When I use this command I am getting
-bash: $: command not found
am I missing something
chithra mohanavelu
 
Posts: 21
Joined: Wed Sep 03, 2008 7:27 pm

Re: X1 Question 6

Postby ollie wright on Wed Dec 17, 2008 8:58 am

#!/bin/bash <-------------- This should be the first line of your script. I made the same mistake!
User avatar
ollie wright
 
Posts: 88
Joined: Wed Sep 03, 2008 7:28 pm

Re: X1 Question 6

Postby alexa bolas on Wed Dec 17, 2008 2:02 pm

I did not think of putting the command in script form. However, [i]banner 'date'[/i] just displays the word date. [i]banner $(date)[/i] displays Wed Dec 17 13:00:51 PST 2008. It is the latter that I was trying to get at and my understanding of what was being asked.
alexa bolas
 
Posts: 30
Joined: Wed Sep 03, 2008 7:28 pm

Next

Return to CIS 90 - Fall 2008

Who is online

Users browsing this forum: No registered users and 0 guests

cron