#vi test.sh
========================
#!/bin/bash
echo "Today is `date`"
========================
save the file and exit.
#chmod 755 test.sh
Run the script
#./test.sh
Today is Tue Aug 19 15:31:58 IST 2008
Search
Monday, August 18, 2008
Subscribe to:
Post Comments (Atom)
1 comment:
Hello, I am new to Linux. I'm having a hard time--I need wo write a script thast will take a single filename as an argument and add execute permission to the file for the user, but only if the file is a refular file. The script must check to see that there is exactly one argument. If there is no arguments or more than one arguments, the script must produce a "usage" message that tells how to use the script.This is what I came up with--Is this correct?
$cat addexec.sh
if test $# -f 0
then
echo "usage: $0 addexec.sh" 1>&2
exit1
Post a Comment