Expanding a little on what Corona688 has already said, the who utility uses its standard input file descriptor to determine the terminal being used as your controlling terminal. If your script is not the first process in a pipeline or if standard input is redirected from a non-terminal device file, it might not know how to determine who you are.
On a macOS or BSD system, these conditions would lead to output similar to:
instead of the normal output:
that I get when standard input is connected to my terminal. I'm surprised that Linux (at least Ubuntu Linux) doesn't give you any output at all.
This User Gave Thanks to Don Cragun For This Post:
Hi,
I have a bash script which I have referenced in the rc.local of my fedora linux OS. However it doesnt respond the same as when run in terminal from fedora.
The bash script has a series of interactive questions that require user input as shown:
#!/bin/bash
echo "Do you want to use... (1 Reply)
I am trying to create a menu, and the script fails on ln 38 (Files in pwd). Any idea on where the problem is??
Thanks for the help
Rob
#!/bin/bash
# Cool Script for Weekly Assignment 2 (#3) that creates a menu to act as a ui
# and run some popular commands.
clear
while :
do ... (9 Replies)
Hello!
For the moment some settings in my .bashrc contain the password of my company's firewall, which is not a good idea. I would like to use the string "PASSWORD" set in .bashrc and a script that changes all appearances of "PASSWORD" in the environment variables by the actual password (which... (4 Replies)
Hello,
I am not sure, where I am missing in the scirpt, I am trying to grep few users from /etc/passwd file and if exists, I added line to echo as user exist, if not create it.
#!/bin/bash
for vid in v707 z307 z496 z163 z292 ; do
if
then
echo " $vid User exists "
else
... (2 Replies)
HI,
I have a file serverlist in that all host names are placed.
i have written a small script
#./testping
#! /bin/bash
for i in `cat serverlist`
do
ping $i >> output.txt
done
so now it creates a file output.txt till here fine..
now each time i run this script the output file... (4 Replies)
Hi
I have a bash script which takes parameters
sh /tmp/gdg.sh -b BASE-NAME -n 1 -s /source/data -p /dest/data/archive -m ARC
gdg.sh will scan the /source/data and will move the contents to /dest/data/archive after passing through some filters. Its working superb from bash
I have... (0 Replies)
Hi,
I am trying to run a python script embedded in bash script. But is throwing me an error. Please help.
Script:
#!/bin/bash
nohup /usr/bin/python /opt/web/http.py &
Error:
/usr/bin/python: can't open file '/opt/web/http.py': No such file or directory
Please help me on this. (6 Replies)
Hi,
I am new to shell/bash script. I am trying to run below script
#!/bin/bash
a=0
b=10
if
then
echo "a is equal to be"
else
echo "a is not equal to be"
fi
MAX=10
while
do
echo $a
a='expr $a + 1'
done (1 Reply)
Hi,
Below is my script, which is used to invoke a test using curl command.
#/usr/bin/sh
MAILTO=user@xyz.com
URL='https://myserver.xyz.net/test/dir/test123.tws'
SOAPFILE=/tmp/soap.txt
curl -k -s -S --header 'Content-Type: text/xml;charset=UTF-8' --data @"${SOAPFILE}" "${URL}"
... (3 Replies)
Repeat this text in a file named notes.txt and run the script
Before bash is a good language a blank line appears
Also, the following notes are displayed incorrectly
What is bad?
==================================
Title : Note 1
==================================
Category: Computer
Date... (3 Replies)