I'm trying to use augtool in shell script ex:


augtool <<-EOF
print /augeas/load

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

$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?


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

  • 2
    FWIW I can't reproduce your problem -- when I run your first script, it completes in less than a second. – Flup Jun 17 '13 at 11:11
  • 3
    You may run your script through strace in oder to see what's happening: strace -o script.strace -f /path/to/script – Hauke Laging Jun 17 '13 at 11:45
  • 1
    Why do you use the - in front of the first EOF, in <<-EOF? – Bernhard Jun 18 '13 at 5:47

Like @Flup, I can't reproduce your issue.

Also note that you can actually also use augtool as an interpreter, too:

#!/usr/bin/augtool -f
print /augeas/load

Combining this with the -s (--autosave) flag if you want to make modification without explicitely calling save at the end of your script.


What happens if you explicitly quit from within the commands to augtool?


augtool <<-EOF
print /augeas/load

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.