How do I suppress GtkDialog warnings in zenity and yad using Bash redirection in a script?How to make zenity “transient parent” warning disappear permanentlybash script and zenity progressrun bash script from another script and redirect its outputPort redirection for a specific (dynamic) IP using iptables scriptHiding terminal when executing zenity bash script by double clickBuilding a dynamic zenity list using bash variableZenity and bashRandom script using bashHow to make zenity “transient parent” warning disappear permanentlyBash one-liner to display ALL `gsettings` in Zenity or YadHow to suppress warnings in gromacs?

Must a warlock replace spells with new spells of exactly their Pact Magic spell slot level?

How to cut a climbing rope?

Why do Russians almost not use verbs of possession akin to "have"?

Why does the hash of infinity have the digits of π?

Are runways booked by airlines to land their planes?

Why would a rational buyer offer to buy with no conditions precedent?

Time complexity of an algorithm: Is it important to state the base of the logarithm?

Did this character show any indication of wanting to rule before S8E6?

Is it legal to have an abortion in another state or abroad?

Popcorn is the only acceptable snack to consume while watching a movie

USPS Back Room - Trespassing?

Need to read my home electrical Meter

The art of clickbait captions

Why are GND pads often only connected by four traces?

Why A=2 and B=1 in the call signs for Spirit and Opportunity?

What is the meaning of "<&3" and "done < file11 3< file22"

Take elements from a list based on two criteria

If a (distance) metric on a connected Riemannian manifold locally agrees with the Riemannian metric, is it equal to the induced metric?

Are black holes spherical during merger?

What Armor Optimization applies to a Mithral full plate?

Function argument returning void or non-void type

Why are Stein manifolds/spaces the analog of affine varieties/schemes in algebraic geometry?

Why isn't 'chemically-strengthened glass' made with potassium carbonate to begin with?

What are the conditions for RAA?



How do I suppress GtkDialog warnings in zenity and yad using Bash redirection in a script?


How to make zenity “transient parent” warning disappear permanentlybash script and zenity progressrun bash script from another script and redirect its outputPort redirection for a specific (dynamic) IP using iptables scriptHiding terminal when executing zenity bash script by double clickBuilding a dynamic zenity list using bash variableZenity and bashRandom script using bashHow to make zenity “transient parent” warning disappear permanentlyBash one-liner to display ALL `gsettings` in Zenity or YadHow to suppress warnings in gromacs?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2

















I'm trying to suppress GtkDialog warnings in zenity and yad:



$ zenity --error --text hello
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.


Error redirection and filtering works:



$ zenity --error --text hello 2> >(grep -v GtkDialog >&2)


YEAH... Annoying warning message disappears!!



This can be placed in ~/.bashrc for development work as answered here:



  • How to make zenity “transient parent” warning disappear permanently (using function)

and here:



  • How to make zenity “transient parent” warning disappear permanently (using alias)

When creating a script for others to use though, you don't want the burden of them changing their ~/.bashrc.




I'm having trouble creating a typing shortcut for: 2> >(grep -v GtkDialog >&2) to be used inside script.



For many reasons variable assignment GTK_SPAM="2> >(grep -v GtkDialog >&2)" followed later by variable usage "$GTK_SPAM" doesn't work.



alias zenity="zenity 2> >(grep -v GtkDialog >&2)" before calling script works but, I can't use this within a script.



Using an array to hold the typing shortcut isn't working:



$ aGtkSpam=(2> >(grep -v GtkDialog >&2))

$ DumpArray "$aGtkSpam[@]"
Array Elements:
0: 2>
1: >(grep
2: -v
3: GtkDialog
4: >&2)

$ zenity --error --text hello "$aGtkSpam[@]"
This option is not available. Please see --help for all possible usages.

$ yad --text hello 2> >(grep -v GtkDialog >&2)

$ yad --text hello "$aGtkSpam[@]"
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.


I found many excellent generic answers on word-splitting and parameters which should solve my problem but a specific syntax eludes me.



Any clues?










share|improve this question



















  • 2





    Can't you just redirect stderr for the duration of the script using exec? Something like exec 2> >(grep -v GtkDialog >&2)

    – steeldriver
    May 17 at 17:16











  • @steeldriver you mean use that command on second line after the #!/bin/bash?

    – WinEunuuchs2Unix
    May 17 at 17:21











  • anywhere before where you want to start filtering the stream - doesn't have to be right after the shebang

    – steeldriver
    May 17 at 17:24











  • steeldriver's suggestion is good and works in interactive shells as well. @steeldriver I would recommend making an answer out of that.

    – Sergiy Kolodyazhnyy
    May 17 at 17:32











  • Array may have to be unquoted for this to work

    – Sergiy Kolodyazhnyy
    May 17 at 17:33

















2

















I'm trying to suppress GtkDialog warnings in zenity and yad:



$ zenity --error --text hello
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.


Error redirection and filtering works:



$ zenity --error --text hello 2> >(grep -v GtkDialog >&2)


YEAH... Annoying warning message disappears!!



This can be placed in ~/.bashrc for development work as answered here:



  • How to make zenity “transient parent” warning disappear permanently (using function)

and here:



  • How to make zenity “transient parent” warning disappear permanently (using alias)

When creating a script for others to use though, you don't want the burden of them changing their ~/.bashrc.




I'm having trouble creating a typing shortcut for: 2> >(grep -v GtkDialog >&2) to be used inside script.



For many reasons variable assignment GTK_SPAM="2> >(grep -v GtkDialog >&2)" followed later by variable usage "$GTK_SPAM" doesn't work.



alias zenity="zenity 2> >(grep -v GtkDialog >&2)" before calling script works but, I can't use this within a script.



Using an array to hold the typing shortcut isn't working:



$ aGtkSpam=(2> >(grep -v GtkDialog >&2))

$ DumpArray "$aGtkSpam[@]"
Array Elements:
0: 2>
1: >(grep
2: -v
3: GtkDialog
4: >&2)

$ zenity --error --text hello "$aGtkSpam[@]"
This option is not available. Please see --help for all possible usages.

$ yad --text hello 2> >(grep -v GtkDialog >&2)

$ yad --text hello "$aGtkSpam[@]"
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.


I found many excellent generic answers on word-splitting and parameters which should solve my problem but a specific syntax eludes me.



Any clues?










share|improve this question



















  • 2





    Can't you just redirect stderr for the duration of the script using exec? Something like exec 2> >(grep -v GtkDialog >&2)

    – steeldriver
    May 17 at 17:16











  • @steeldriver you mean use that command on second line after the #!/bin/bash?

    – WinEunuuchs2Unix
    May 17 at 17:21











  • anywhere before where you want to start filtering the stream - doesn't have to be right after the shebang

    – steeldriver
    May 17 at 17:24











  • steeldriver's suggestion is good and works in interactive shells as well. @steeldriver I would recommend making an answer out of that.

    – Sergiy Kolodyazhnyy
    May 17 at 17:32











  • Array may have to be unquoted for this to work

    – Sergiy Kolodyazhnyy
    May 17 at 17:33













2












2








2










I'm trying to suppress GtkDialog warnings in zenity and yad:



$ zenity --error --text hello
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.


Error redirection and filtering works:



$ zenity --error --text hello 2> >(grep -v GtkDialog >&2)


YEAH... Annoying warning message disappears!!



This can be placed in ~/.bashrc for development work as answered here:



  • How to make zenity “transient parent” warning disappear permanently (using function)

and here:



  • How to make zenity “transient parent” warning disappear permanently (using alias)

When creating a script for others to use though, you don't want the burden of them changing their ~/.bashrc.




I'm having trouble creating a typing shortcut for: 2> >(grep -v GtkDialog >&2) to be used inside script.



For many reasons variable assignment GTK_SPAM="2> >(grep -v GtkDialog >&2)" followed later by variable usage "$GTK_SPAM" doesn't work.



alias zenity="zenity 2> >(grep -v GtkDialog >&2)" before calling script works but, I can't use this within a script.



Using an array to hold the typing shortcut isn't working:



$ aGtkSpam=(2> >(grep -v GtkDialog >&2))

$ DumpArray "$aGtkSpam[@]"
Array Elements:
0: 2>
1: >(grep
2: -v
3: GtkDialog
4: >&2)

$ zenity --error --text hello "$aGtkSpam[@]"
This option is not available. Please see --help for all possible usages.

$ yad --text hello 2> >(grep -v GtkDialog >&2)

$ yad --text hello "$aGtkSpam[@]"
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.


I found many excellent generic answers on word-splitting and parameters which should solve my problem but a specific syntax eludes me.



Any clues?










share|improve this question


















I'm trying to suppress GtkDialog warnings in zenity and yad:



$ zenity --error --text hello
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.


Error redirection and filtering works:



$ zenity --error --text hello 2> >(grep -v GtkDialog >&2)


YEAH... Annoying warning message disappears!!



This can be placed in ~/.bashrc for development work as answered here:



  • How to make zenity “transient parent” warning disappear permanently (using function)

and here:



  • How to make zenity “transient parent” warning disappear permanently (using alias)

When creating a script for others to use though, you don't want the burden of them changing their ~/.bashrc.




I'm having trouble creating a typing shortcut for: 2> >(grep -v GtkDialog >&2) to be used inside script.



For many reasons variable assignment GTK_SPAM="2> >(grep -v GtkDialog >&2)" followed later by variable usage "$GTK_SPAM" doesn't work.



alias zenity="zenity 2> >(grep -v GtkDialog >&2)" before calling script works but, I can't use this within a script.



Using an array to hold the typing shortcut isn't working:



$ aGtkSpam=(2> >(grep -v GtkDialog >&2))

$ DumpArray "$aGtkSpam[@]"
Array Elements:
0: 2>
1: >(grep
2: -v
3: GtkDialog
4: >&2)

$ zenity --error --text hello "$aGtkSpam[@]"
This option is not available. Please see --help for all possible usages.

$ yad --text hello 2> >(grep -v GtkDialog >&2)

$ yad --text hello "$aGtkSpam[@]"
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.


I found many excellent generic answers on word-splitting and parameters which should solve my problem but a specific syntax eludes me.



Any clues?







command-line bash redirect






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 18 at 10:31









dessert

27.3k682115




27.3k682115










asked May 17 at 16:54









WinEunuuchs2UnixWinEunuuchs2Unix

50.8k12100195




50.8k12100195







  • 2





    Can't you just redirect stderr for the duration of the script using exec? Something like exec 2> >(grep -v GtkDialog >&2)

    – steeldriver
    May 17 at 17:16











  • @steeldriver you mean use that command on second line after the #!/bin/bash?

    – WinEunuuchs2Unix
    May 17 at 17:21











  • anywhere before where you want to start filtering the stream - doesn't have to be right after the shebang

    – steeldriver
    May 17 at 17:24











  • steeldriver's suggestion is good and works in interactive shells as well. @steeldriver I would recommend making an answer out of that.

    – Sergiy Kolodyazhnyy
    May 17 at 17:32











  • Array may have to be unquoted for this to work

    – Sergiy Kolodyazhnyy
    May 17 at 17:33












  • 2





    Can't you just redirect stderr for the duration of the script using exec? Something like exec 2> >(grep -v GtkDialog >&2)

    – steeldriver
    May 17 at 17:16











  • @steeldriver you mean use that command on second line after the #!/bin/bash?

    – WinEunuuchs2Unix
    May 17 at 17:21











  • anywhere before where you want to start filtering the stream - doesn't have to be right after the shebang

    – steeldriver
    May 17 at 17:24











  • steeldriver's suggestion is good and works in interactive shells as well. @steeldriver I would recommend making an answer out of that.

    – Sergiy Kolodyazhnyy
    May 17 at 17:32











  • Array may have to be unquoted for this to work

    – Sergiy Kolodyazhnyy
    May 17 at 17:33







2




2





Can't you just redirect stderr for the duration of the script using exec? Something like exec 2> >(grep -v GtkDialog >&2)

– steeldriver
May 17 at 17:16





Can't you just redirect stderr for the duration of the script using exec? Something like exec 2> >(grep -v GtkDialog >&2)

– steeldriver
May 17 at 17:16













@steeldriver you mean use that command on second line after the #!/bin/bash?

– WinEunuuchs2Unix
May 17 at 17:21





@steeldriver you mean use that command on second line after the #!/bin/bash?

– WinEunuuchs2Unix
May 17 at 17:21













anywhere before where you want to start filtering the stream - doesn't have to be right after the shebang

– steeldriver
May 17 at 17:24





anywhere before where you want to start filtering the stream - doesn't have to be right after the shebang

– steeldriver
May 17 at 17:24













steeldriver's suggestion is good and works in interactive shells as well. @steeldriver I would recommend making an answer out of that.

– Sergiy Kolodyazhnyy
May 17 at 17:32





steeldriver's suggestion is good and works in interactive shells as well. @steeldriver I would recommend making an answer out of that.

– Sergiy Kolodyazhnyy
May 17 at 17:32













Array may have to be unquoted for this to work

– Sergiy Kolodyazhnyy
May 17 at 17:33





Array may have to be unquoted for this to work

– Sergiy Kolodyazhnyy
May 17 at 17:33










3 Answers
3






active

oldest

votes


















7














I don't think syntax alone can help you here - because of the order in which the shell sets up redirections and expands variables. To give a very simple illustration:



$ arr=( ">" "/dev/null" )
$ set -x
$ echo foo "$arr[@]"
+ echo foo '>' /dev/null
foo > /dev/null


i.e. everything has been expanded "correctly", but > /dev/null has simply become a list of string arguments passed to echo.



You could force evaluation using eval:



$ eval echo foo "$arr[@]"
+ eval echo foo '>' /dev/null
++ echo foo


but really it would be better to redirect the stream for the duration of your script using exec:



exec 2> >(grep -v GtkDialog >&2)


or, if you want to be able to turn the filter off before the end of the script, then based on After using exec 1>file, how can I stop this redirection of the STDOUT to file and restore the normal operation of STDOUT? it should be possible to do



exec 3>&2 2> >(grep -v GtkDialog >&2)


and then later



exec 2>&3 3>&-


to recover the duplicated stream.






share|improve this answer


















  • 1





    I haven't tested everything but exec 2> >(grep -v 'GtkDialog mapped without a transient parent' >&2) in script before using yad works fine as far as I can tell.

    – WinEunuuchs2Unix
    May 17 at 18:41


















6














You can use function in the script. zenity and yad have useful info in stdout, so I suggest to redirect just stderr to /dev/null



#/bin/bash

zen_nospam()
zenity "$@" 2&>1 >(grep -v GtkDialog >&2)


zen_nospam --error --text hello


btw function can be defined in .bashrc if needed in command line, not script






share|improve this answer

























  • Your answer is sort of where I started from: askubuntu.com/a/1110850/307523 and askubuntu.com/a/896940/307523

    – WinEunuuchs2Unix
    May 17 at 17:26











  • @WinEunuuchs2Unix Please add all this information to your question!

    – dessert
    May 17 at 18:41











  • @dessert I added this to question introduction but perhaps it could be worded better.

    – WinEunuuchs2Unix
    May 17 at 19:30


















6














You can define and use aliases in your script if you set the expand_aliases shell option, e.g.:





#!/bin/bash
shopt -s expand_aliases
alias zenity='zenity 2> >(grep -v GtkDialog >&2)'



Now every zenity line behaves as if 2> >(grep -v GtkDialog >&2) were added and you can disable this behaviour as usual by prepending a backslash or command:



zenity # and
command zenity


both ignore the alias.



Further reading



  • Why doesn't my Bash script recognize aliases?





share|improve this answer























  • Although upvoting your answer I'm still using SteelDriver's answer for the time-being. Your answer did inspire me to use shopt -u expand_aliases so aliases cannot create unstable environment for my script. In other words, turn off all the user's aliases so the script doesn't behave erratically.

    – WinEunuuchs2Unix
    May 17 at 23:42











  • @WinEunuuchs2Unix That’s not necessary, as “Aliases are not expanded when the shell is not interactive” – if you didn’t set the option before in your script it’s no use.

    – dessert
    May 18 at 7:17











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1144080%2fhow-do-i-suppress-gtkdialog-warnings-in-zenity-and-yad-using-bash-redirection-in%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














I don't think syntax alone can help you here - because of the order in which the shell sets up redirections and expands variables. To give a very simple illustration:



$ arr=( ">" "/dev/null" )
$ set -x
$ echo foo "$arr[@]"
+ echo foo '>' /dev/null
foo > /dev/null


i.e. everything has been expanded "correctly", but > /dev/null has simply become a list of string arguments passed to echo.



You could force evaluation using eval:



$ eval echo foo "$arr[@]"
+ eval echo foo '>' /dev/null
++ echo foo


but really it would be better to redirect the stream for the duration of your script using exec:



exec 2> >(grep -v GtkDialog >&2)


or, if you want to be able to turn the filter off before the end of the script, then based on After using exec 1>file, how can I stop this redirection of the STDOUT to file and restore the normal operation of STDOUT? it should be possible to do



exec 3>&2 2> >(grep -v GtkDialog >&2)


and then later



exec 2>&3 3>&-


to recover the duplicated stream.






share|improve this answer


















  • 1





    I haven't tested everything but exec 2> >(grep -v 'GtkDialog mapped without a transient parent' >&2) in script before using yad works fine as far as I can tell.

    – WinEunuuchs2Unix
    May 17 at 18:41















7














I don't think syntax alone can help you here - because of the order in which the shell sets up redirections and expands variables. To give a very simple illustration:



$ arr=( ">" "/dev/null" )
$ set -x
$ echo foo "$arr[@]"
+ echo foo '>' /dev/null
foo > /dev/null


i.e. everything has been expanded "correctly", but > /dev/null has simply become a list of string arguments passed to echo.



You could force evaluation using eval:



$ eval echo foo "$arr[@]"
+ eval echo foo '>' /dev/null
++ echo foo


but really it would be better to redirect the stream for the duration of your script using exec:



exec 2> >(grep -v GtkDialog >&2)


or, if you want to be able to turn the filter off before the end of the script, then based on After using exec 1>file, how can I stop this redirection of the STDOUT to file and restore the normal operation of STDOUT? it should be possible to do



exec 3>&2 2> >(grep -v GtkDialog >&2)


and then later



exec 2>&3 3>&-


to recover the duplicated stream.






share|improve this answer


















  • 1





    I haven't tested everything but exec 2> >(grep -v 'GtkDialog mapped without a transient parent' >&2) in script before using yad works fine as far as I can tell.

    – WinEunuuchs2Unix
    May 17 at 18:41













7












7








7







I don't think syntax alone can help you here - because of the order in which the shell sets up redirections and expands variables. To give a very simple illustration:



$ arr=( ">" "/dev/null" )
$ set -x
$ echo foo "$arr[@]"
+ echo foo '>' /dev/null
foo > /dev/null


i.e. everything has been expanded "correctly", but > /dev/null has simply become a list of string arguments passed to echo.



You could force evaluation using eval:



$ eval echo foo "$arr[@]"
+ eval echo foo '>' /dev/null
++ echo foo


but really it would be better to redirect the stream for the duration of your script using exec:



exec 2> >(grep -v GtkDialog >&2)


or, if you want to be able to turn the filter off before the end of the script, then based on After using exec 1>file, how can I stop this redirection of the STDOUT to file and restore the normal operation of STDOUT? it should be possible to do



exec 3>&2 2> >(grep -v GtkDialog >&2)


and then later



exec 2>&3 3>&-


to recover the duplicated stream.






share|improve this answer













I don't think syntax alone can help you here - because of the order in which the shell sets up redirections and expands variables. To give a very simple illustration:



$ arr=( ">" "/dev/null" )
$ set -x
$ echo foo "$arr[@]"
+ echo foo '>' /dev/null
foo > /dev/null


i.e. everything has been expanded "correctly", but > /dev/null has simply become a list of string arguments passed to echo.



You could force evaluation using eval:



$ eval echo foo "$arr[@]"
+ eval echo foo '>' /dev/null
++ echo foo


but really it would be better to redirect the stream for the duration of your script using exec:



exec 2> >(grep -v GtkDialog >&2)


or, if you want to be able to turn the filter off before the end of the script, then based on After using exec 1>file, how can I stop this redirection of the STDOUT to file and restore the normal operation of STDOUT? it should be possible to do



exec 3>&2 2> >(grep -v GtkDialog >&2)


and then later



exec 2>&3 3>&-


to recover the duplicated stream.







share|improve this answer












share|improve this answer



share|improve this answer










answered May 17 at 18:00









steeldriversteeldriver

73k11119194




73k11119194







  • 1





    I haven't tested everything but exec 2> >(grep -v 'GtkDialog mapped without a transient parent' >&2) in script before using yad works fine as far as I can tell.

    – WinEunuuchs2Unix
    May 17 at 18:41












  • 1





    I haven't tested everything but exec 2> >(grep -v 'GtkDialog mapped without a transient parent' >&2) in script before using yad works fine as far as I can tell.

    – WinEunuuchs2Unix
    May 17 at 18:41







1




1





I haven't tested everything but exec 2> >(grep -v 'GtkDialog mapped without a transient parent' >&2) in script before using yad works fine as far as I can tell.

– WinEunuuchs2Unix
May 17 at 18:41





I haven't tested everything but exec 2> >(grep -v 'GtkDialog mapped without a transient parent' >&2) in script before using yad works fine as far as I can tell.

– WinEunuuchs2Unix
May 17 at 18:41













6














You can use function in the script. zenity and yad have useful info in stdout, so I suggest to redirect just stderr to /dev/null



#/bin/bash

zen_nospam()
zenity "$@" 2&>1 >(grep -v GtkDialog >&2)


zen_nospam --error --text hello


btw function can be defined in .bashrc if needed in command line, not script






share|improve this answer

























  • Your answer is sort of where I started from: askubuntu.com/a/1110850/307523 and askubuntu.com/a/896940/307523

    – WinEunuuchs2Unix
    May 17 at 17:26











  • @WinEunuuchs2Unix Please add all this information to your question!

    – dessert
    May 17 at 18:41











  • @dessert I added this to question introduction but perhaps it could be worded better.

    – WinEunuuchs2Unix
    May 17 at 19:30















6














You can use function in the script. zenity and yad have useful info in stdout, so I suggest to redirect just stderr to /dev/null



#/bin/bash

zen_nospam()
zenity "$@" 2&>1 >(grep -v GtkDialog >&2)


zen_nospam --error --text hello


btw function can be defined in .bashrc if needed in command line, not script






share|improve this answer

























  • Your answer is sort of where I started from: askubuntu.com/a/1110850/307523 and askubuntu.com/a/896940/307523

    – WinEunuuchs2Unix
    May 17 at 17:26











  • @WinEunuuchs2Unix Please add all this information to your question!

    – dessert
    May 17 at 18:41











  • @dessert I added this to question introduction but perhaps it could be worded better.

    – WinEunuuchs2Unix
    May 17 at 19:30













6












6








6







You can use function in the script. zenity and yad have useful info in stdout, so I suggest to redirect just stderr to /dev/null



#/bin/bash

zen_nospam()
zenity "$@" 2&>1 >(grep -v GtkDialog >&2)


zen_nospam --error --text hello


btw function can be defined in .bashrc if needed in command line, not script






share|improve this answer















You can use function in the script. zenity and yad have useful info in stdout, so I suggest to redirect just stderr to /dev/null



#/bin/bash

zen_nospam()
zenity "$@" 2&>1 >(grep -v GtkDialog >&2)


zen_nospam --error --text hello


btw function can be defined in .bashrc if needed in command line, not script







share|improve this answer














share|improve this answer



share|improve this answer








edited May 17 at 17:31

























answered May 17 at 17:22









LeonidMewLeonidMew

1,7641127




1,7641127












  • Your answer is sort of where I started from: askubuntu.com/a/1110850/307523 and askubuntu.com/a/896940/307523

    – WinEunuuchs2Unix
    May 17 at 17:26











  • @WinEunuuchs2Unix Please add all this information to your question!

    – dessert
    May 17 at 18:41











  • @dessert I added this to question introduction but perhaps it could be worded better.

    – WinEunuuchs2Unix
    May 17 at 19:30

















  • Your answer is sort of where I started from: askubuntu.com/a/1110850/307523 and askubuntu.com/a/896940/307523

    – WinEunuuchs2Unix
    May 17 at 17:26











  • @WinEunuuchs2Unix Please add all this information to your question!

    – dessert
    May 17 at 18:41











  • @dessert I added this to question introduction but perhaps it could be worded better.

    – WinEunuuchs2Unix
    May 17 at 19:30
















Your answer is sort of where I started from: askubuntu.com/a/1110850/307523 and askubuntu.com/a/896940/307523

– WinEunuuchs2Unix
May 17 at 17:26





Your answer is sort of where I started from: askubuntu.com/a/1110850/307523 and askubuntu.com/a/896940/307523

– WinEunuuchs2Unix
May 17 at 17:26













@WinEunuuchs2Unix Please add all this information to your question!

– dessert
May 17 at 18:41





@WinEunuuchs2Unix Please add all this information to your question!

– dessert
May 17 at 18:41













@dessert I added this to question introduction but perhaps it could be worded better.

– WinEunuuchs2Unix
May 17 at 19:30





@dessert I added this to question introduction but perhaps it could be worded better.

– WinEunuuchs2Unix
May 17 at 19:30











6














You can define and use aliases in your script if you set the expand_aliases shell option, e.g.:





#!/bin/bash
shopt -s expand_aliases
alias zenity='zenity 2> >(grep -v GtkDialog >&2)'



Now every zenity line behaves as if 2> >(grep -v GtkDialog >&2) were added and you can disable this behaviour as usual by prepending a backslash or command:



zenity # and
command zenity


both ignore the alias.



Further reading



  • Why doesn't my Bash script recognize aliases?





share|improve this answer























  • Although upvoting your answer I'm still using SteelDriver's answer for the time-being. Your answer did inspire me to use shopt -u expand_aliases so aliases cannot create unstable environment for my script. In other words, turn off all the user's aliases so the script doesn't behave erratically.

    – WinEunuuchs2Unix
    May 17 at 23:42











  • @WinEunuuchs2Unix That’s not necessary, as “Aliases are not expanded when the shell is not interactive” – if you didn’t set the option before in your script it’s no use.

    – dessert
    May 18 at 7:17















6














You can define and use aliases in your script if you set the expand_aliases shell option, e.g.:





#!/bin/bash
shopt -s expand_aliases
alias zenity='zenity 2> >(grep -v GtkDialog >&2)'



Now every zenity line behaves as if 2> >(grep -v GtkDialog >&2) were added and you can disable this behaviour as usual by prepending a backslash or command:



zenity # and
command zenity


both ignore the alias.



Further reading



  • Why doesn't my Bash script recognize aliases?





share|improve this answer























  • Although upvoting your answer I'm still using SteelDriver's answer for the time-being. Your answer did inspire me to use shopt -u expand_aliases so aliases cannot create unstable environment for my script. In other words, turn off all the user's aliases so the script doesn't behave erratically.

    – WinEunuuchs2Unix
    May 17 at 23:42











  • @WinEunuuchs2Unix That’s not necessary, as “Aliases are not expanded when the shell is not interactive” – if you didn’t set the option before in your script it’s no use.

    – dessert
    May 18 at 7:17













6












6








6







You can define and use aliases in your script if you set the expand_aliases shell option, e.g.:





#!/bin/bash
shopt -s expand_aliases
alias zenity='zenity 2> >(grep -v GtkDialog >&2)'



Now every zenity line behaves as if 2> >(grep -v GtkDialog >&2) were added and you can disable this behaviour as usual by prepending a backslash or command:



zenity # and
command zenity


both ignore the alias.



Further reading



  • Why doesn't my Bash script recognize aliases?





share|improve this answer













You can define and use aliases in your script if you set the expand_aliases shell option, e.g.:





#!/bin/bash
shopt -s expand_aliases
alias zenity='zenity 2> >(grep -v GtkDialog >&2)'



Now every zenity line behaves as if 2> >(grep -v GtkDialog >&2) were added and you can disable this behaviour as usual by prepending a backslash or command:



zenity # and
command zenity


both ignore the alias.



Further reading



  • Why doesn't my Bash script recognize aliases?






share|improve this answer












share|improve this answer



share|improve this answer










answered May 17 at 19:55









dessertdessert

27.3k682115




27.3k682115












  • Although upvoting your answer I'm still using SteelDriver's answer for the time-being. Your answer did inspire me to use shopt -u expand_aliases so aliases cannot create unstable environment for my script. In other words, turn off all the user's aliases so the script doesn't behave erratically.

    – WinEunuuchs2Unix
    May 17 at 23:42











  • @WinEunuuchs2Unix That’s not necessary, as “Aliases are not expanded when the shell is not interactive” – if you didn’t set the option before in your script it’s no use.

    – dessert
    May 18 at 7:17

















  • Although upvoting your answer I'm still using SteelDriver's answer for the time-being. Your answer did inspire me to use shopt -u expand_aliases so aliases cannot create unstable environment for my script. In other words, turn off all the user's aliases so the script doesn't behave erratically.

    – WinEunuuchs2Unix
    May 17 at 23:42











  • @WinEunuuchs2Unix That’s not necessary, as “Aliases are not expanded when the shell is not interactive” – if you didn’t set the option before in your script it’s no use.

    – dessert
    May 18 at 7:17
















Although upvoting your answer I'm still using SteelDriver's answer for the time-being. Your answer did inspire me to use shopt -u expand_aliases so aliases cannot create unstable environment for my script. In other words, turn off all the user's aliases so the script doesn't behave erratically.

– WinEunuuchs2Unix
May 17 at 23:42





Although upvoting your answer I'm still using SteelDriver's answer for the time-being. Your answer did inspire me to use shopt -u expand_aliases so aliases cannot create unstable environment for my script. In other words, turn off all the user's aliases so the script doesn't behave erratically.

– WinEunuuchs2Unix
May 17 at 23:42













@WinEunuuchs2Unix That’s not necessary, as “Aliases are not expanded when the shell is not interactive” – if you didn’t set the option before in your script it’s no use.

– dessert
May 18 at 7:17





@WinEunuuchs2Unix That’s not necessary, as “Aliases are not expanded when the shell is not interactive” – if you didn’t set the option before in your script it’s no use.

– dessert
May 18 at 7:17

















draft saved

draft discarded
















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1144080%2fhow-do-i-suppress-gtkdialog-warnings-in-zenity-and-yad-using-bash-redirection-in%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form