Avatar of Frog_1337
Frog_1337
 asked on

UNiX Script filesystem space usage

I am working on a simple script and I cannot get the command to execute. I am certain I am missing a quote somewhere but cannot get the command to run. The script I have is below. The command by itself executes. When attempting to run in a script it will not

#! /bin/sh

OUTPUT="$(df | egrep "([89][0-9]|100)%")"
Echo "$(OUTPUT)"
Shell ScriptingUnix OS

Avatar of undefined
Last Comment
Gerwin Jansen

8/22/2022 - Mon
Gerwin Jansen

output=$(df | egrep "([89][0-9]|100)%")
echo ${output}
Frog_1337

ASKER
This is not working. The output is blank where as the command ran by itself gives the filesystems over the percentage
SOLUTION
omarfarid

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
omarfarid

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Frog_1337

ASKER
No its only echoing the command not the output
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
SOLUTION
omarfarid

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Frog_1337

ASKER
Still not working. I just need this command to echo an output

df | egrep "([89][0-9]|100)%"
omarfarid

please run below command then post output:

df | egrep "[89][0-9]|100%"
SOLUTION
Gerwin Jansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Frog_1337

ASKER
(258)==> df | egrep "([89][0-9]|100)%"
/dev/vg00/sysadmlv 2097152 1669080  401479   81% /sysadm
wins04:root:[/]
(259)==>
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Frog_1337

ASKER
When I try the echo$(command) I still do not get output
SOLUTION
arnold

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Frog_1337

ASKER
Still no output. Im thinking I may have to take a different route or something
SOLUTION
arnold

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Frog_1337

ASKER
This is hpux 11.1 so no -k function.
df |egrep '\%' Gives full df output when ran normally
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
SOLUTION
omarfarid

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Gerwin Jansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Frog_1337

ASKER
It was the case sensitive issue thank you
Gerwin Jansen

You're welcome ;)