2

I seem to be chasing my tail...

The terminal command

x-terminal-emulator -e ${SHELL}' -c cd\ .;"ls";'${SHELL}

when run on Ubuntu 14.04/16.04/18.04 launches a new terminal and lists the current directory (as expected).

If I modify the command to include the "-l" argument

x-terminal-emulator -e ${SHELL}' -c cd\ .;"ls -l";'${SHELL}

I get the expected result on Ubuntu 14.04/16.04, but on 18.04 (as a virtual machine under VirtualBox) the launched terminal contains the message:

sh: 1: ls -l: not found

I ran both commands on Ubuntu 17.10 and whilst both commands produced the expected result, I noticed the following 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.
Warning: DESKTOP_STARTUP_ID not set and no fallback available.

Bottom line: I cannot figure out if I am hitting some new issue with spaces treated differently in the latest terminal and/or now having to use "--" and I am using the command incorrectly.

Ultimately, I want to not just have "ls -l" but a string of commands, separated by "&&".

Bernmeister
  • 1,231

1 Answers1

0

I wasn't able to determine why I was getting the error message

sh: 1: ls -l: not found

but did manage to achieve my goal. The command that works (which is a simplified version of what I ultimately want) is:

gnome-terminal -- /bin/bash -c 'cd .; ls -l; /bin/bash'

I took the approach that I'm only running this on Ubuntu and so was "safe" to swap out x-terminal-emulator with gnome-terminal and $SHELL with bash.

Bernmeister
  • 1,231