03-12-2008
Quote:
Originally Posted by
tragic54
I was wondering what command lines i could use to do the following.
1. mail a file to a user with a subject line "HELLO". Also, send a Blind carbon copy to a different user?
2. Display the number of files AND directories in a given directory?
3. Display the last 5 files in a given directory?
I've searched all the manual pages i could possibly think of and i can't seem to find the answers to these. Thanks!
Ans(Q1) :
mail -s HELLO
person1@domain.com -b
person2@domain.com <file.txt
(This will send the contents of the file as mail contents to person1 and blind carbon copies to person2)
uuencode file.txt file.txt | mail -s HELLO
person1@domain.com -b
person2@domain.com
(this will send the file as attachement to person1 and blind carbon copy to person2.Attachment can be send if and only if the file is encoded)
Ans(Q2) :
ls -Rl | awk 'BEGIN{d=0;f=0;l=0;}{if(/^d/){d++}else if(/^-/){f++}else if(/^l/){l++}}END{print "Directories: "d "\nFiles: " f "\nLinks: " l}'
Ans(Q3) :
ls | tail -5
(List the last five files in a directory)
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
i.e configuration of C compiler :confused: (4 Replies)
Discussion started by: atiato
4 Replies
2. Tips and Tutorials
A
at : execute commands at a specified time/date.
awk: a scripting language, especially useful for manipulating text and automation.
B
bash : invokes the Bourne Again Shell (standard on most boxes).
batch: execute comands when load permits.
bc : interactive C-like calcultor (integers... (6 Replies)
Discussion started by: binhnx2000
6 Replies
3. Shell Programming and Scripting
Hi there,
I am looking to create a single file called outputa.txt, which will show the contents of my directorya and its sub directories, and all file and directory permissions.
What command would be used for this?
Cheers
Kev (2 Replies)
Discussion started by: kev112
2 Replies
4. UNIX for Dummies Questions & Answers
Hi Group ,
I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages.
- i m writing
>write user-id
! ls
o
ctrl-d
inspite of executing the command ls,other terminal shows ! ls.
Thnx in advance. (2 Replies)
Discussion started by: Aashish
2 Replies
5. UNIX for Dummies Questions & Answers
echo -n "1. Updating Password Policy in OID..." | tee -a $logfile
set ldap_v1 = `ldapsearch -b "" -h $oid_host -p $oid_port -D "cn=orcladmin" -w $admin_pwd -s sub "cn=PwdPolicyEntry" dn | head -1`
echo "dn:$ldap_v1" > ldap1.out
echo "changetype:modify" >> ldap1.out
echo... (2 Replies)
Discussion started by: maoro
2 Replies
6. UNIX for Dummies Questions & Answers
cdfcxvvbbvnbjmjnhjml. (1 Reply)
Discussion started by: sree11
1 Replies
7. Shell Programming and Scripting
Hi Gurus
I am very new to Unix Shell Prog. I have a file in format
Q1 Dirname-FileName Score Remarks
i.e. containing columns separated by space. I want to read Column 1 and 2 and then join them to make a string that would be a path to a file. I will use this string to fetch the files and... (4 Replies)
Discussion started by: kimskams80
4 Replies
8. UNIX for Dummies Questions & Answers
i have two requirement
a file1 has field CNT=1000
i want to take count on file2 which can be like 2000
and replace in file1 so it becomes CNT=2000
a file1 has field TSTMP=2008-11-06-15.54.20.000000
i want to take the file creation date on file2 which can be like... (1 Reply)
Discussion started by: er_zeeshan05
1 Replies
9. UNIX for Dummies Questions & Answers
I need two solutions
1) How can i swap the first and last character in each line of file temp
2) How can i display content of the file using sed command
Please help (2 Replies)
Discussion started by: champu
2 Replies
10. Shell Programming and Scripting
I am new to unix so this is probably a pretty basic question.
I am trying to write several commands on one line that creates a directory called bf in the current directory, then copy all files within that directory and any subdirectories, that do not start with the letter c to the new bf folder.... (5 Replies)
Discussion started by: scotty85
5 Replies
LEARN ABOUT DEBIAN
script-email
SCRIPT-EMAIL(8) System Administration Commands SCRIPT-EMAIL(8)
NAME
script-email - Amanda script to send email notifications
DESCRIPTION
script-email is an Amanda script implementing the Script API. It should not be run by users directly. It sends a notification email to the
addresses specified in the MAILTO property.
PROPERTIES
This section lists the properties that control script-email's functionality. See amanda-scripts(7) for information on the Script API,
script configuration.
MAILTO
List of email addresses that will receive an email on command execution. It is a multi-valued property:
property "MAILTO" "amanda@domain.com" "sysadmin@domain.com" "amandauser@domain.com"
EXAMPLE
In this example, script-email is scheduled to be run before the DLE, on the server. The unqualified email address amanda will be passed to
the email system unchanged. The script is then attached to a dumptype, which can then be specified for any DLEs which require
notification.
define script-tool pre-email {
comment "email me before this DLE is backed up"
plugin "script-email"
execute-on pre-dle-backup
execute-where server
property "mailto" "amanda"
}
define dumptype user-tar-email {
user-tar
script "pre-email"
}
SEE ALSO
amanda(8), amanda.conf(5), amanda-client.conf(5), amanda-scripts(7)
The Amanda Wiki: : http://wiki.zmanda.com/
AUTHORS
Jean-Louis Martineau <martineau@zmanda.com>
Zmanda, Inc. (http://www.zmanda.com)
Dustin J. Mitchell <dustin@zmanda.com>
Zmanda, Inc. (http://www.zmanda.com)
Amanda 3.3.1 02/21/2012 SCRIPT-EMAIL(8)