A better way of always dumping Gedit out of Terminal? I use terminal alot, so it was frustrating to me to deal with gedit's inconsistent behavior between having a window open and when one was not. I ended up searching around, and finding a way of getting around this. I've created this bash script, and aliased it to gedit, and I've slowly been expanding it.

Basically the script does these things:


Checks to see if arguments exist, if not, it opens gedit with no document
If arguments do exist, it iterates over each and opens them all.


This creates consistent behavior where gedit won't stick in terminal dumping log data.

#!/bin/bash

if [[ -z $1 ]]; then
    /usr/bin/gedit &amp;
else
    for var in "$@"
    do
        /usr/bin/gedit "$var" &amp;
    done
fi


My question is if there are any glaring errors here, or if there is a cleaner, faster way of doing this? I'm specifically interested in the loop, as I feel there should be an easier way of passing list data as a single string. The reason I didn't just use $* for that, is when I tried the fact that it's wrapped in quotes caused it to open a single document with all parameters listed as the file name.

I added the quotes for a reason that I should have documented, but I currently do not remember.
If you just want to make gedit operate silently and in the background, I would create a function (save in ~/.bashrc)

gedit() { command gedit "$@" &amp;&gt;/dev/null &amp; }


Also, Accessing bash command line args $@ vs $*