You are not logged in.

#1 2015-02-02 10:03:05

drtebi
Member
Registered: 2013-02-09
Posts: 148

[SOLVED] Stop "foreign" error output from shell script

Hello,

I have just migrated from TrueCrypt to VeraCrypt (without issues by the way), but I have a problem with a script that I wrote.

This script is basically a shortcut for mounting a VeraCrypt volume and opening it with Dolphin; it keeps a "question" open at the command line, which, when answered with 'y', will unmount the volume.

Here is the important part of the script:

    /usr/bin/veracrypt "$VERACRYPT" "$MOUNTDIR"
    /usr/bin/dolphin "$MOUNTDIR"
    echo "Unmount VeraCrypt volume now [y/n]?"
    read ANSWER
    if [ "$ANSWER" = "y" ]
    then
        /usr/bin/veracrypt -d "$VERACRYPT"
    fi
    exit 0

As you can see, it's utterly simple. My problem now is, that some system message shows up when running the command, and it somehow hides my "question":

"/org/freedesktop/UDisks2/block_devices/dm_2d0" has new interfaces: ("org.freedesktop.UDisks2.Block", "org.freedesktop.UDisks2.Filesystem") 
"/org/freedesktop/UDisks2/block_devices/dm_2d0" has new interfaces: ("org.freedesktop.UDisks2.Block", "org.freedesktop.UDisks2.Filesystem") 

I thought it was veracrypt or Dolphin related, and I tried adding "2> /dev/null" at the end of those commands, but it appears that this message comes from somewhere else.

Is there a way to suppress these "foreign" messages? Why does my "question" not show up anymore at all?

Thanks,
DrTebi

Last edited by drtebi (2015-02-02 23:41:39)

Offline

#2 2015-02-02 10:08:15

drtebi
Member
Registered: 2013-02-09
Posts: 148

Re: [SOLVED] Stop "foreign" error output from shell script

I just realized that my "question" is not hidden... once I close Dolphin, it appears.

However, I still cannot get rid of those system messages.

Is there a way to get rid of those?

Offline

#3 2015-02-02 13:49:13

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: [SOLVED] Stop "foreign" error output from shell script

Have you tried redirecting stdout as well?

/usr/bin/veracrypt "$VERACRYPT" "$MOUNTDIR" >/dev/null 2>&1
/usr/bin/dolphin "$MOUNTDIR" >/dev/null 2>&1

As for the question being 'hidden' you just need to background whichever process is blocking.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2015-02-02 23:41:26

drtebi
Member
Registered: 2013-02-09
Posts: 148

Re: [SOLVED] Stop "foreign" error output from shell script

That worked, thanks!

I have to assume that veracrypt caused the "new interfaces" message then?

I didn't try the redirecting to stdout at first because I thought if I do that, I would not get my "question" -- but that was of course wrong, since I am not redirecting the "read" command.

Thanks for the help.

Offline

Board footer

Powered by FluxBB