Need explanation of script

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need explanation of script
# 1  
Old 11-25-2007
Need explanation of script


Can anybody explain what this script is doing?

who | cut -d " " -f1 | sort -u > userlist1
while true ; do
sleep 60
who | cut -d" " -f1 | sort -u >userlist2
for username in `cat userlist1` ; do
if ! grep "^$username$" userlist2 > /dev/null ; then
echo "$username has logged out"
for username in `cat userlist2` ; do
if ! grep "^$username$" userlist1>/dev/null; then
echo "$username hass logged in"
mv userlist2 userlist1;

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script explanation

Hey, can someone explain me this script? i=0 while read WORT do echo $WORT|grep a>/dev/null || echo$WORT|grep B>dev/null || let i=$i+1 done echo $i The first lane initializie the variable i with the value of 0. The loop line has 3 different options because of ||. The only option I... (10 Replies)
Discussion started by: newuser21
10 Replies

2. Shell Programming and Scripting

What does this shell script do? Need in depth explanation please

Hi My friend wrote this particular script and won't tell me what it does, and when I run it I don't understand it. What does the entire script do with specifics please. Thanks Bob #!/bin/bash current=0 while ; do if ; then echo ${current} current=$((${current}+1)) fi done (1 Reply)
Discussion started by: shadowknight777
1 Replies

3. Shell Programming and Scripting

Explanation of FNR in this awk script

To merge mutiple *.tab files as: rs1 A A rs2 A A rs3 C C rs4 C Cfile2.ind rs1 T T rs2 T T rs3 G G rs4 G Gand rs1 B B rs2 B B rs3 L L rs4 L LOutput: AA TT BB AA TT BB CC GG LL CC GG ... (4 Replies)
Discussion started by: yifangt
4 Replies

4. Solaris

Explanation of script

Hello Guys, can someone help explain the script below for me? I will really appreciate it. vi db_script #!/bin/sh echo .cron job run on.`date`> cronjob.txt df -h >> cronjob.txt echo welcome to home (2 Replies)
Discussion started by: cjashu
2 Replies

5. Shell Programming and Scripting

need an explanation on this script...

The following script will create a directory in a directory and will go on as many times as the number you will give in. I am trying to find out how it works ... can someone please help me with that? #!/bin/sh #create a variable and set it to 1 n=1 #start a loop as... (3 Replies)
Discussion started by: I-1
3 Replies

6. Shell Programming and Scripting

Script explanation

#script fileused=test.txt ftp $hostname <<-! > $fileused.err 2>&1 put file.txt /usr/text.txt bye ! kindly the above script the one marked as Bold and underlined as the above i am declaring the new variable as filename ,But when i used i had used as $fileused.err... (1 Reply)
Discussion started by: rajar_r
1 Replies

7. Shell Programming and Scripting

Shell Script Explanation

Hello, I have seen this script on this site. I understand most of it. However I am a bit stuck on the part in red. It appears to be expanding for file in *.zip do zipdir=${file%.*} mkdir $zipdir || echo "unable to create $zipdir" cp $file $zipdir || echo "unable to copy $file"... (3 Replies)
Discussion started by: jaysunn
3 Replies

8. Shell Programming and Scripting

explanation for a script

Guys, was wondering what the meaning of the below bit is ? awk -F ' ' '{print $1 " " $2 ;}' $TEMPFILE | (rm -f $TEMPFILE; sed 's/$/ '"$box"'/g' > $TEMPFILE) Can anyone explain this in detail? what is the significance of rm -f $TEMPFILE here? What all IO/buffering happens here ?How the... (0 Replies)
Discussion started by: hashin_p
0 Replies

9. Shell Programming and Scripting

Explanation of running this script

I have a script that has defined a log file like this. The name of the script is Inside the script there is some thing like this. LOG=/usr/verify TDATE=`date "+%m%d%y"$$` LOGFILE=$LOG.$TDATE. and inside the script it has been written as echo "This is to verify" | tee -a... (2 Replies)
Discussion started by: sendhilmani
2 Replies

10. Shell Programming and Scripting

Script explanation

I have the following script awk '$1 ~ /^*+/ { s += $NF; m++ } END { print NR, m, s } and I use it to get results from the following file A4792 4 COMP9021 5 K9 7 ABC 8 924 1 R2D2 3 (8 Replies)
Discussion started by: sickboy
8 Replies
Login or Register to Ask a Question
NPM-RUN-SCRIPT(1)														 NPM-RUN-SCRIPT(1)

npm-run-script - Run arbitrary package scripts SYNOPSIS
npm run-script <command> [--silent] [-- <args>...] alias: npm run DESCRIPTION
This runs an arbitrary command from a package's "scripts" object. If no "command" is provided, it will list the available scripts. run[-script] is used by the test, start, restart, and stop commands, but can be called directly, as well. When the scripts in the package are printed out, they're separated into lifecycle (test, start, restart) and directly-run scripts. As of `, you can use custom arguments when executing scripts. The special option -- is used by getopt to delimit the end of the options. npm will pass all the arguments after the -- directly to your script: npm run test -- --grep="pattern" The arguments will only be passed to the script specified after npm run and not to any pre or post script. The env script is a special built-in command that can be used to list environment variables that will be available to the script at run- time. If an "env" command is defined in your package, it will take precedence over the built-in. In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example, if there is a devDependency on tap in your package, you should write: "scripts": {"test": "tap test/*.js"} instead of "scripts": {"test": "node_modules/.bin/tap test/*.js"} to run your tests. The actual shell your script is run within is platform dependent. By default, on Unix-like systems it is the /bin/sh command, on Windows it is the cmd.exe. The actual shell referred to by /bin/sh also depends on the system. As of ` you can customize the shell with the script-shell configuration. Scripts are run from the root of the module, regardless of what your current working directory is when you call npm run. If you want your script to use different behavior based on what subdirectory you're in, you can use the INIT_CWD environment variable, which holds the full path you were in when you ran npm run. npm run sets the NODE environment variable to the node executable with which npm is executed. Also, if the --scripts-prepend-node-path is passed, the directory within which node resides is added to the PATH. If --scripts-prepend-node-path=auto is passed (which has been the default in npm v3), this is only performed when that node executable is not found in the PATH. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install, just in case you've forgotten. You can use the --silent flag to prevent showing npm ERR! output on error. You can use the --if-present flag to avoid exiting with a non-zero exit code when the script is undefined. This lets you run potentially undefined scripts without breaking the execution chain. SEE ALSO
o npm help 7 scripts o npm help test o npm help start o npm help restart o npm help stop o npm help 7 config January 2019 NPM-RUN-SCRIPT(1)