11-24-2008
Unix Horror story script question
This text and script is borrowed from the "Unix Horror Stories" document.
It states as follows
"""""Management told us to email a security notice to every user on the our system (at that time, around 3000 users). A certain novice administrator on our system wanted to do it, so I instructed them to extract a list of users from /etc/passwd, write a simple shell loop to do the job, and throw it in the background.
Here's what they wrote (bourne shell)...
for USER in `cat user.list`;
do mail $USER <message.text &
done
Have you ever seen a load average of over 300 ??? """" END
My question is this- What is wrong with the script above? Why did it find a place in the Horror stories? It worked well when I tried it.
Maybe he intended to throw the whole script in the background and not just the Mail part. But even so it works just as well... So?
6 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi to all in forum and I hope someone will be able to help.
It is likely that over the next couple of months I have to get a hands on knowledge of Unix due to incoming work in company and I hope to be able to get some knowledge from the general Unix community.
In the meantime I have one... (2 Replies)
Discussion started by: kencheck
2 Replies
2. Homework & Coursework Questions
This is a problem with basic Unix scripting. Thanks for looking!
1. The problem statement, all variables and given/known data:
Make a script that will compare 2 given directories and output those filenames that are in Directory 1 and not 2
2. Relevant commands, code, scripts, algorithms:... (1 Reply)
Discussion started by: iamhungry
1 Replies
3. Shell Programming and Scripting
Hello,
I am a new Unix user and new to shell programming. I am working on a script to go through a log file and find the text error:
grep -i 'error' monplus.mplog
if I find the text error in the log file I would like to echo a message to the operator staing there is an error
I am currently... (2 Replies)
Discussion started by: dtracy01
2 Replies
4. Shell Programming and Scripting
I have the following script
=========
#!/bin/sh
MUTEXPREFIX="/tmp/"
READMUTEX=(test globallock)
# If mutexes found - exit out
for m in "${READMUTEX}"; do
|| (echo "$0 Mutex file found - Exiting\n" ; exit 1)
done;
echo "After for loop\n";
exit;=============
What i want... (8 Replies)
Discussion started by: GosarJunk
8 Replies
5. Homework & Coursework Questions
i am trying to write a script code in unix that will:
1. The problem statement, all variables and given/known data:
display following menu to user:
(A) Add
(B) Subtract
(C) Multiply
(D) Divide
(E) Modulus
(F) Exponentiation
(G) Exit
Then ask user for choice (A-F). After taking... (5 Replies)
Discussion started by: renegade755
5 Replies
6. Shell Programming and Scripting
I need to check whether the directory is exist or not. only three letter will be passed as argument. from that it should pick the entire directory.
Instead of banking and manfucuture the input will be passed as man or ban.
$1 -> ban $2-> monday
#!/bin/sh
DIR='/sales/$1*/monday'
if ;... (3 Replies)
Discussion started by: arun888
3 Replies
LEARN ABOUT FREEBSD
atf-sh
ATF-SH(1) BSD General Commands Manual ATF-SH(1)
NAME
atf-sh [-s shell] -- interpreter for shell-based test programs
SYNOPSIS
atf-sh script
DESCRIPTION
atf-sh is an interpreter that runs the test program given in script after loading the atf-sh(3) library.
atf-sh is not a real interpreter though: it is just a wrapper around the system-wide shell defined by ATF_SHELL. atf-sh executes the inter-
preter, loads the atf-sh(3) library and then runs the script. You must consider atf-sh to be a POSIX shell by default and thus should not
use any non-standard extensions.
The following options are available:
-s shell Specifies the shell to use instead of the value provided by ATF_SHELL.
ENVIRONMENT
ATF_LIBEXECDIR Overrides the builtin directory where atf-sh is located. Should not be overridden other than for testing purposes.
ATF_PKGDATADIR Overrides the builtin directory where libatf-sh.subr is located. Should not be overridden other than for testing purposes.
ATF_SHELL Path to the system shell to be used in the generated scripts. Scripts must not rely on this variable being set to select a
specific interpreter.
EXAMPLES
Scripts using atf-sh(3) should start with:
#! /usr/bin/env atf-sh
Alternatively, if you want to explicitly choose a shell interpreter, you cannot rely on env(1) to find atf-sh. Instead, you have to hardcode
the path to atf-sh in the script and then use the -s option afterwards as a single parameter:
#! /path/to/bin/atf-sh -s/bin/bash
ENVIRONMENT
ATF_SHELL Path to the system shell to be used in the generated scripts.
SEE ALSO
atf-sh(3)
BSD
September 27, 2014 BSD