6

This title has a duplicated question and confirmed as a bug. But it was in Ubuntu 17, mine is Ubuntu 18.04 LTS. So I guess the bug in the old question is fixed. Bug I still encounter it, so here is my problem:

File disk.desktop >>

[Desktop Entry]
Name=Disk Manager
Comment=Open df cmd in Terminal
Icon=harddisk
Type=Application
Categories=Utility;Management;
Keywords=disk; manager; terminal;
StartupNotify=true
Exec=gnome-terminal -t "Disk Manager" --hide-menubar -e "df -h --output=source,used,size,avail,target -x devtmpfs -x tmpfs -x squashfs"

The star is in the last line:
gnome-terminal -t "Disk Manager" --hide-menubar -e "df -h --output=source,used,size,avail,target -x devtmpfs -x tmpfs -x squashfs"

My command is run gnome-terminal which execute the df app with a few arguments of it. The .desktop file has a very weird behavior. It simply does nothing, not even firing error code.

If I remove all of its arguments except the -h, it works some times. If I run df app in a running terminal, it runs very well. So my money's on gnome-terminal's fault.

I decided copy my whole command to an running terminal. And the result is half-title:

# Option “-e” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.

Since I got no error code. I have no idea what to do next. Please tell me how to fix it. Thanks.

Update 7-Feb-2019 ::

Follow @vidarlo advise, I've changed to option flag --. Here is the result:

  • -- doesn't work with command within the " " quote. It returns a fail execution error: Fail to execute child process "df -h"
  • I couldn't find any doc for this option. Not in man not in --help-all. It seems to me that this flag is not standard yet.

What I look for is an option allow me to pass command with a few arguments. In Lubuntu, it looks like this lxterminal -e "df -h -x devtmpfs -x tmpfs -x squashfs".

1
5

Read the error message:

# Option “-e” is deprecated and might be removed in a later version of gnome-terminal.
# Use “-- ” to terminate the options and put the command line to execute after it.

The error message tells you that -e is deprecated, and may be removed in future versions, and the alternative to -e.

You have the following command line:

Exec=gnome-terminal -t "Disk Manager" --hide-menubar -e "df -h -- output=source,used,size,avail,target -x devtmpfs -x tmpfs -x squashfs"

Change this to

Exec=gnome-terminal -t "Disk Manager" --hide-menubar -- "df -h --output=source,used,size,avail,target -x devtmpfs -x tmpfs -x squashfs"
1
  • 13
    The -- only work without " to me. Which means I cannot use arguments. If I do like this: gnome-terminal -- "df -h", it will open a new terminal with an error: "Fail to execute child process"... Also, I found no man for the option -- of gnome-terminal at all. – user910555 Feb 7 '19 at 14:43
3

You want:

gnome-terminal -t "Disk Manager" --hide-menubar -- df -h --output=source,used,size,avail,target -x devtmpfs -x tmpfs -x squashfs

-- is generally the universal command line syntax for "nothing after this should be interpreted as an option". In this case, GNOME Terminal just takes any arguments it's given and executes them as a command line, with the first argument as the program as the rest as the program's arguments.

-- "df..." failed because it was using the entire command line as the executable name.

0

I've could use -- with command that contains parameters (remember remove doble quotation marks which surround the command to be passed to the terminal. Otherwise it will fail)

Exec=/usr/bin/gnome-terminal -- globalprotect connect -u $USER_VPN -p $VPN_TO_CONNECT

This worked fine for me. Execute the complete line in your terminal (avoid the Exec= part obviously) before save the file to check if it's working as you expected or not and so save time.

Your Answer

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