terminal
terminal copied to clipboard
Elementary terminal does not properly respect -e flag
would like to automate showing of a nice weather report you can launch in terminal:
curl wttr.in/bydgoszcz
with follwoing script launched from the system menu:
#!/bin/sh
exec io.elementary.terminal -e "curl wttr.in/bydgoszcz"
But this way the output gets a little "incomplete", just like if the command got executed too fast (notice where the user@machine line went here):
So, is there a way to delay the command after -e flag?
Or maybe totally different approach will automate this to show the output properly?
Tried also this:
#!/bin/sh
WTTR=$(curl -s wttr.in/bydgoszcz) && \
exec io.elementary.terminal -e "echo $WTTR"
but it produced this:
When doublequoted -
-e "echo "$WTTR""
- the output is single word - weather
When tried -e 'echo "$WTTR" '
- output is $WTTR
When tried -e echo "$WTTR"
- the output is empty line
After trying this:
#!/bin/sh
exec io.elementary.terminal -e "sleep1s & curl wttr.in/bydgoszcz"
The output is a single dot...
...and once the terminal gets closed in this case, the whole user session gets restarted! :astonished:
I've run out of ideas :face_with_head_bandage:
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Probably related to (or even the same as) VTE 777686.
I can't get there to be a new tab with passed commands. dunnow what I'm doing wrong :
io.elementary.terminal -e "echo hi; sleep 6"
new tab opens with commands echoed. and stays open.
At the moment the -e option can only cope with a single command, not sequential commands. So to execute multiple sequential commands, they would have to be put into a script and then execute that with -e.
this cannot do. I'm trying to port a script from ubuntu to elementary. I can't have the script execute the code saved in a variable for one and the code exported to a script file for the other that's way too much redundant code.
I really think feature parity with the base should be attained before switching to something else.
in this case the base you're working from is ubuntu, gnome-terminal has a basic amount of functionality.
I'd like for elementary terminal to have feature-parity.
What was the equivalent gnome-terminal script?
notice the comment at 558. I'm having to resort to xterm to get it to run.
my script : https://github.com/tatsujb/installFAFscript
short story :
gnome-terminal --tab --active --title="install & run steam, steamcmd, FA" -- bash -c 'do all the things that I want to do in a new windows, including but not limited to opening another window with a bunch of commands'
Thanks. I'll see what can be done.
@DanyGee : Try this command:
io.elementary.terminal -e "bash -c 'curl wttr.in/bydgoszcz';'sleep 3'"
This works for me both typed directly into a terminal and when put in a script and run from Files (using the master version of Terminal).
@tatsujb : Multiple bash commands are possible using nested quote marks as shown in the above comment. Not sure whether that is enough for your problem though.
hey, again this is problematic, (it's this realistically) :
io_opening_faf_script='io.elementary.terminal -e "bash -c '"'"'curl wttr.in/bydgoszcz'"'"';'"'"'sleep 3'"'"'"; '"'"''#trailing escaped colon to allow for a big evaluatable variable to fit after this
and does not solve the duplication of code issue :
every single line from line 343 to 526 would have to have an escaped colon : '"'"'
at the start and at the end of the line.
which might break the functioning for the other terminals (three of them, konsole, gnome-terminal and xterm) which right now are all able to use the same lines from 343 to 526 without unscoping.
Yes, I guessed as much. I was just trying to give @DanyGee a solution to his particular problem.
Gnome-terminal is a much more complex program than elementary terminal so the code is not simply transferable unfortunately.
but what about reverting to gnome-terminal for elementary?
I really see no good attribute or saving grace of io.elementary.terminal
other than it being very slightly themed.
out-of the box gnome-terminal wouldn't look too estranged in elementary and it is themable to boot.
you could work your way towards elementary's looks instead of working your way towards gnome-terminal's functionality. (which surprisingly is apparently "low-tier functionality", so where does that leave io.elementary.terminal?)
That is a discussion you would need to have with the elementary design team. I think they would disagree that elementary terminal is only "very slightly" themed. A significant amount of work beyond theming would be needed to make and maintain a similar gnome-terminal fork. Also elementary favors Vala programs and gnome-terminal is in C.
I'll look into why the extra quoting is needed for elementary terminal and whether it can be eliminated. At the moment the code just relies on Shell.parse_argv ()
to parse the command string. Maybe our own parser is needed.
FYI I use this service from a much simpler script:
#!/bin/bash
curl wttr.in/${1}
I called it ~/bin/weather.sh
(as I'm unable to remember "wttr.in") and it accepts location as an argument, e.g. weather.sh ostrava
. I don't use the other features but they are the same kind of string so it should work fine too.
@DanyGee Have you tried using the new -x
flag instead of -e
?