We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [test]

This is about the Unix utility "test," also invoked as "[", or its shell syntax [[ … ]] variant. For questions about testing software and setups, use the "testing" tag.

13 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
652 views

How to reliably detect stdin pipe in Bash in batch mode?

I need a way to test whether input to my Bash script has been piped to stdin when the script is run in batch mode. The method I use when I run the script interactively (the test [ -p /dev/stdin ]) ...
3
votes
0answers
757 views

How to simulate power outage for a single NUT client?

I've changed the behaviour of a single server (configured as netclient) when on UPS, but I'm not sure how to test it in isolation. dummy-ups seems related, but even the configuration looks completely ...
2
votes
1answer
220 views

Bash: Regex for comparing file path

I want to check if an input string matches whitelisted file paths, then only I want to perform some operation. I am doing something like this path1="mydir/**" path2="mydir/testing" [ [ "$path2" =~ "...
2
votes
0answers
77 views

test fails to find files with processed path

I have backup of /home/kuba/mp3 on external usb hard drive /media/kuba/JCUBIC/mp3 and I move some files to different directories on usb drive and now I want to sync the files from usb to my home ...
2
votes
0answers
122 views

Some errors have occured when I installed lucene, a perl module!

Some errors have occured when I installed lucene, a perl module: [xlwang@localhost Lucene-0.18]$ make test Running Mkbootstrap for Lucene () chmod 644 Lucene.bs PERL_DL_NONLAZY=1 /home/xlwang/local/...
1
vote
0answers
720 views

Test/Simulate SNMP traps on disk failures

On my monitored system I configure SNMP to sent traps in the event that hardware failures occur. For example, I add the following (rather well-known) line to my snmpd.conf file: monitor -60 -o ...
1
vote
0answers
57 views

problems with running tcsh file

I can't get the following program to run. When I try running it, it says set goal = `head -c 15 < /dev/urandom | base64 | sed 's/[^0-9]//g' | sed' Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]...
1
vote
2answers
73 views

Please tell how this command checks whether rnum has an integer or not

I saw a construct like this in a shell script, being used to test if $rnum is a number: if ! [ "$rnum" -eq "$rnum" ] 2> /dev/null; then echo "rnum is not a number" exit 1 fi It appears to ...
0
votes
1answer
899 views

Linux “stress” tool

I have seen one of the trick to use 90% of the available system memory with following command : stress --vm-bytes $(awk '/MemFree/{printf "%d\n", $2 * 0.9;}' < /proc/meminfo)k --vm-keep -m 1. ...
0
votes
2answers
108 views

Problem with data comparison in if loop

I have 2 variables in bash. Using test i found out that one of them is integer and other one is string. I want to compare them and see if they are equal. I tried the following options. if [ "$a" -eq "...
0
votes
2answers
886 views

Script to check existence of and compare directories file count

I'm still pretty new to unix and scripting and I'm trying to write a script that can take an input directory from the user, check if it exists, then compare the number of files in the given directory ...
-1
votes
1answer
20 views

test for existing directory passes for directory that does not exist

Action I have set an environment variable in a user profile export DATADIR=<absolute path set with `readlink -e target`> Expected outcomes After sourcing the profile file again, I checked ...
-2
votes
1answer
273 views

string comparison not working with sqlplus output

Code: iIMSI=`sqlplus -s ${APP_ORA_USER}/${APP_ORA_PASS}@${APP_DB_INST} << EOF SET HEAD OFF PAGESIZE 0 LINESIZE 1000 TRIMOUT ON TIMING OFF select resource_value from agd1_resources where ...