I'm trying to use augtool in shell script ex:
#!/bin/bash
augtool <<-EOF
print /augeas/load
EOF
However if I execute this script, the script will run indefinitely with no output and the CPU usage is 100% via top cmd.
the command can be run successfully using
$augtool
$print /augeas/load
/augeas/load/Webmin/excl[4] = "/*.dpkg-bak"
/augeas/load/Webmin/excl[5] = "/*.dpkg-new"
/augeas/load/Webmin/excl[6] = "/*.dpkg-old"
/augeas/load/Webmin/excl[7] = "/*.rpmsave"
/augeas/load/Webmin/excl[8] = "/*.rpmnew"
/augeas/load/Webmin/excl[9] = "/*~"
... lots of output...
augtool> quit
I'm using Ubuntu 12.04.2 and the version of augtool is 0.10.0.
My question is: how to use augtool in shell script?
[edited]
I execute the strace command and get the following error:
lstat64("/augeas/load/", 0xbfc637d8) = -1 ENOENT (No such file or directory)
and then it keeps looping and showing:
write(2, "\7", 1) = 1
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
read(0, "", 1) = 0
However if I execute this script with root, it runs successfully
strace -o script.strace -f /path/to/script
-
in front of the firstEOF
, in<<-EOF
?