this post was submitted on 24 Dec 2024
256 points (96.0% liked)
Programmer Humor
19821 readers
888 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
gnome-terminal -- sh -c "my_command"
This will open that command in new terminal window at loginHey, I was working on the same problem the other day and maybe you can help me with it a bit further. If you don't mind.
I like to run gotop on my second monitor so I can watch my system resources, and normally I just open a terminal window and type gotop and it runs and stays open and continually updates. I've made this command into a shell script to run at startup. Using this script presumably halfway works, because a terminal window shows up, but it tells me "the child process exited normally with status 127." and prompts for relaunch (which does nothing except present the same message again).
Now the internet tells me that 127 generally means "command not found" which doesn't really make sense to me because gotop is in my PATH and can be run normally without any kind of special arguments or location if I pop open a terminal and do it myself. So I'm not really sure where the problem lies. The script in question is currently parked on my desktop and when I run it manually, when logged in and everything, nothing changes except that I also get an additional terminal window that states the child process exited normally with status 0.
I'm brand new to both Linux and shell scripting so I barely have any idea what I'm doing here, I've gathered through individual research that I should also have a line starting the file with
#! /bin/bash
but I'm not actually even too confident about that part. Currently the entire script reads as follows:#! /bin/bash gnome-terminal -- sh -c gotop
I've tried with and without quotes on gotop and I've tried with and without the hashbang and none of the four options have given me different results, which makes me think I'm barking at the wrong tree. I have made the script executable so I don't think that's the problem.
O wise one, please bestow upon the poor noob your knowledge. (This request is also open to other wise ones who may be passing by.)
Honestly, I have no idea :D. What I would try is:
1st check that the command is on 2nd line of script (1st line is only
#!/bin/bash
, note that there is no space) but that might seem wrong only due to lemmy formatting.2nd I'd try using full path of gotop binary. Use
which gotop
to find where it is. Must start with a/
3rd I'd try w/o script at all. The command I quoted works in Cinnamon startup applications from the "start" menu, add new entry there with your command.
4th chatgpt knows a lot about common linux problems.