简体   繁体   中英

How do I create a shortcut for a command line command in Raspbian Stretch?

I am attempting to install RetroPie as an app on Raspbian Stretch and I am done except for creating a desktop shortcut for it. The problem is that the only way to open RetroPie seems to be running a command in the command line. I can't do it in terminal because it gives me an error saying that it can't initialize the window. Is there a way to run a command line command as a shortcut or am I going to have to find another way of doing this?

PS Here is the tutorial that I followed to install RetroPie: https://www.makeuseof.com/tag/install-retropie-app-raspberry-pi/

Probably your shell (on the raspberry) is GNU bash . So read the manual of GNU bash .

You probably want (once) to edit some Bash startup file (such as ~/.bashrc ) to define functions and aliases there, and you could add executable shell script s somewhere in your $PATH . I recommend having a $HOME/bin/ directory containing your scripts and executables, and have $HOME/bin/ early in your $PATH .

I can't do it in terminal because it gives me an error saying that it can't initialize the window.

Perhaps you need some display server (such as Xorg or Wayland ) running (with a desktop environment or a window manager ). You could run Xorg on your PC (on which you could install Linux) and connect to the raspberry using ssh -X then remote applications running on your Raspberry are displayed on your PC. IF your Raspberry is directly connected to a screen (via HDMI) you might run some Xorg server on it.

Is there a way to run a command line command as a shortcut

Yes, by making a shell alias or shell function or shell script. You need to understand how they work and change or create some appropriate file using some source code editor (I recommend GNU emacs , but the choice is yours and you might use any other editor such as vim , gedit , etc...): functions and aliases could be defined in your ~/.bashrc ; shell scripts would usually have their own file with a shebang under your $HOME/bin/ ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM