08-31-2005
Using backticks is not recommended. Your original form was ok save for proper quotation:
str="$(df -k | grep /usr/local)"
which could better be written:
str="$( df -k /usr/local | sed '1d' )"
The second error is because of typo: "${# ...}" only works with arrays, giving back the number of elements in an array.
The whole construction with strlen is not too elegant, this one is easier and does the same:
size="$( df -k /usr/local | sed '1d;s/<spc><spc>*/<spc>/g' | cut -f3 -d'<spc>' )"
(replace "<spc>" with literal space characters)
baknin
Last edited by bakunin; 08-31-2005 at 09:31 PM..
10 More Discussions You Might Find Interesting
1. Solaris
Hi, i would like a help with this problem.
i have the following situation:
4 workstations SUNs:
SunOS porsche 5.8 Generic_117350-18 sun4u sparc SUNW,Sun-Blade-100
SunOS jaguar 5.8 Generic_108528-18 sun4u sparc SUNW,Sun-Blade-100
SunOS mercedes 5.8 Generic_117350-18 sun4u sparc... (2 Replies)
Discussion started by: dougpss
2 Replies
2. UNIX for Dummies Questions & Answers
hey,
i'm trying to run several processes due 2 loops :
the code is:
cd ${TIBCO_HOME}/tra/domain/${DOMAIN}/application/
for app_name in ls *
do
echo $app_name
if && && ;
then
exit
else
echo $app_name
cd $app_name
pwd
for ps_name in ls *.sh
do
echo... (2 Replies)
Discussion started by: ohadr
2 Replies
3. Shell Programming and Scripting
Hi All,
I am running a script which is present on remote machine using ssh command.
the remote script is failing when try to load a property file. It says file does not exist.
Any idea what should be the problem for this.
Thanks
Supriya. (7 Replies)
Discussion started by: supriyabv
7 Replies
4. Shell Programming and Scripting
While executing perl scriptit gives some compling issue, please help out
$inputFilename="c:\allways.pl";
open (FILEH,$inputFilename) or die "Could not open log file";
Error : Could not open log file at c:\allways.pl line 4
learner in Perl (1 Reply)
Discussion started by: allways4u21
1 Replies
5. Shell Programming and Scripting
Hi,
I have following K script, that is in rc0.d directory to be run on shutdown. It's linked using the 'ln' command to init.d.Can anyone tell me as to why it's not running, or if i have incorrect syntax?I get:
"test: argument expected
type=uname -p
+ "
When running it with sh -x
... (8 Replies)
Discussion started by: darrlaw
8 Replies
6. Shell Programming and Scripting
Hi,
I'm trying to run a simple shell script whose contents are pasted below.
#!/usr/bin/ksh
echo $PATH
performbuild
{
echo "Inside performBuild function"
}
echo "Main Shell started"
performbuild
echo "Main Shell ended"
DV> ls -ltr
total 48
-rwxr-xr-x 1 pb5377 it-ibm ... (5 Replies)
Discussion started by: blp_18
5 Replies
7. Shell Programming and Scripting
I am trying to use the CRON utility in Fedora 11 & CentOS...
I intend to run a script which pops up a warning message every hour and i made the following entry using "CRONTAB -e "
* * * * * sh /bin/myscript.sh
But this does not seem to be running.
Another thing to note is that,... (4 Replies)
Discussion started by: Vabiosis
4 Replies
8. Shell Programming and Scripting
Hi all,
I have a script that calls another program/script, xxx, to run in the background. Supposedly this program at most should finish within five (5) minutes so after five (5) minutes, I run some other steps to run the script into completion.
My problem is sometimes the program takes... (5 Replies)
Discussion started by: newbie_01
5 Replies
9. Emergency UNIX and Linux Support
I have getting problem with running gs on a non global zone. This is new zone. Seems something to do with library, but I am not getting correct pointer.
-bash-3.00$ which gs
/usr/local/bin/gs
-bash-3.00$ gs
ld.so.1: gs: fatal: libcairo.so.2: open failed: No such file or directory
Killed... (3 Replies)
Discussion started by: solaris_1977
3 Replies
10. Shell Programming and Scripting
Hi all,
Running follow command on terminal;
$ glance -T cloudlive -I ubuntu -K ubuntu123 -N \
http://127.0.0.1:5000/v2.0/OpenX add name="cirros" is_public=true \
container_format=ovf disk_format=raw < \
/srv/cirros-0.3.0-x86_64-disk.img
It works without problem.
Putting it on a... (5 Replies)
Discussion started by: satimis
5 Replies
LEARN ABOUT MINIX
systemd-rc-local-generator
SYSTEMD-RC-LOCAL-GENERATOR(8) systemd-rc-local-generator SYSTEMD-RC-LOCAL-GENERATOR(8)
NAME
systemd-rc-local-generator - Compatibility generator for starting /etc/rc.local and /usr/sbin/halt.local during boot and shutdown
SYNOPSIS
/lib/systemd/system-generators/systemd-rc-local-generator
DESCRIPTION
systemd-rc-local-generator is a generator that checks whether /etc/rc.local exists and is executable, and if it is pulls the
rc-local.service unit into the boot process. This unit is responsible for running this script during late boot. Note that the script will
be run with slightly different semantics than the original System V version, which was run "last" in the boot process, which is a concept
that does not translate to systemd. The script is run after network.target, but in parallel with most other regular system services.
systemd-rc-local-generator also checks whether /usr/sbin/halt.local exists and is executable, and if it is pulls the halt-local.service
unit into the shutdown process. This unit is responsible for running this script during later shutdown.
Support for both /etc/rc.local and /usr/sbin/halt.local is provided for compatibility with specific System V systems only. However, it is
strongly recommended to avoid making use of these scripts today, and instead provide proper unit files with appropriate dependencies for
any scripts to run during the boot or shutdown processes.
systemd-rc-local-generator implements systemd.generator(7).
SEE ALSO
systemd(1), systemctl(1)
systemd 237 SYSTEMD-RC-LOCAL-GENERATOR(8)