Skip to content

Latest commit

 

History

History
65 lines (56 loc) · 3.43 KB

README.md

File metadata and controls

65 lines (56 loc) · 3.43 KB

| megamenu

Screenshot

Description

Script for terminal to bring up menu options for system and network information and some other useless things ( ̄▽ ̄)ノ

Setting It Up

Place into path environment of terminal app so that it will be permanently accessible. There are several places the scripts can be placed (In our case megamenu.sh). Do not place scripts directly into /bin /sbin/ /usr/bin or /usr/sbin. Sure, they will function there, but they may overwrite an existing function when placed or lost during an update. It is best to avoid $PATH conflicts. Here are some safe options, including Recommended!

Option 1. Placing inside /usr/local/bin stores locally and is seperated from typical program executables. It also makes any script available to all users, however, editing the file in place will require sudo. 🔒 Files in /usr/local/bin override /usr/bin. This should be in $PATH by default. Check by simply typing $PATH in terminal.

/usr/local/bin

If it is not in the $PATH, simply run this to add it.

PATH=$PATH:/usr/local/bin

Option 2. Create a folder in home called bin. These scripts will be available only to that single home user (unless adpated with sybolic links like in next example.) Symlinking to the local folders makes scripts system-wide.

~/bin

Before any scripts in ~/bin can be run you need to add the new path to current $PATH assuming that no symplinking is being used. To add the path use:

PATH=$PATH:~/bin

Doing so with no symlinking will mean that scripts will only be available to a single user.

Recommended! ⤵️

Option 3. Create a folder called scripts in /opt/ (stands for optional); this will generate the aboslute path:

/opt/scripts

With the scripts placed inside this folder the next step is to symbolically link it. Choose between the two locations for a particular behavior. Because it is in local it will be system-wide. The difference here is wether to require root password or not.

  • Execute for normal users; make symbolic link to /usr/local/bin
  • Execute for root; make symbolic link to /usr/local/sbin 🔒 Command example to symbolically link a script for normal users:
 sudo ln -s /opt/scripts/megamenu.sh /usr/local/bin/

⚡ Since symbolic links are going to folders already in $PATH therefore unnecessary to add /opt/scripts to $PATH.

Use

Once one of the above is completed. Close the terminal completely and start it back up again. This will update the environment to include the script.

Now, for using the newly added script simply type the following:

megamenu.sh

If there are any permission issues. It may actually be because the file is not executable. Try running this:

chmod 755 /opt/scripts/megamenu.sh

Though the name has a large connotation, it was kept small so the menu does not fill the entire screen! If you think of anything to add please leave a suggestion at [email protected]

You may edit the file to include your own customizations. This script is elementary and understandable. If you do edit the file, make sure you edit it from /opt/scripts and not from the symlink location /usr/local/bin

If you make something cool, please give me feedback :)

~Thanks, Megacron.