[SOLVED] SMILEYNET Standard Scripts: Debugging Linux Versions
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Thanks! I'm not depending on it anymore in my current version, but I will definately add that flag to the top of my file, for now future issues. I'll try an remember to put that also in any script which calls this.
So when I used this, unless I called it with set -f; specifically, when changing it to '?' again, it didn't work still. It used to just work before. So I'm sticking with my new character, '-'. However, I added that -f flag for a future time, and explained what the comment does. I do NOT want to require major tweaks or specific knowlege of that feature for running the script, as most users besides me, of them will NOT know about that feature yet. This is designed for people on my network, most of which may not know how to turn a computer on until I teach them. At least that's true of my guests so far. I will work on the cross platform stuff a bit later. Right now the goal is to get my scripts to work on Linux Mint 21.2.
#! /bin/bash -f
# If this script is called by another script, you must also use -f flag, which causes the shell not to glob.
if [ $# -lt 1 ]; then
echo "Usage: shelp.sh {command} {topic}"
echo
echo " help - Gets bash help."
echo " man - Gets a man page"
echo " xman - Browses the man pages graphically"
echo " info - Gets an info page"
echo " tldr - Gets a tldr page. Needs sudo permissions!"
echo " - {section or . for all} - List the section help topics"
echo " - {section} {topic} - Gets standard script help"
echo
else
if [ $1 == "man" ]; then
shift
man $@
elif [ $1 == "xman" ]; then
shift
xman $@ &
elif [ $1 == "info" ]; then
shift
info $@
elif [ $1 == "help" ]; then
shift
help $@
elif [ $1 == "tldr" ]; then
shift
sudo tldr $@
elif [ $1 == "-" ]; then
if [ $# -eq 2 ]; then
if [ -d /etc/settings/shelp/$2 ]; then
if [ $2 == ".." ]; then
echo "What topic do you want?"
else
ls /etc/settings/shelp/$2
fi
else
echo "What topic do you want?"
fi
elif [ $# -eq 3 ]; then
if [ -f /etc/settings/shelp/$2/$3 ]; then
less /etc/settings/shelp/$2/$3
fi
else
echo "What topic do you want?"
fi
else
echo "Usage: shelp.sh {command} {topic}"
echo
echo " help - Gets bash help."
echo " man - Gets a man page"
echo " xman - Browses the man pages graphically"
echo " info - Gets an info page"
echo " tldr - Gets a tldr page. Needs sudo permissions!"
echo " - {section or . for all} - List the section help topics"
echo " - {section} {topic} - Gets standard script help"
echo
fi
fi
...And I think I have enough features implemented for it to be a complete version! As soon as I can, I will upload it to github, so that everyone can now benefit from my work. However, before I do that, I must build a bit on top of it, and implement just a little bit more. I have to make sure it works.
I don't know why, besides needing Linux to have the features I need, that I didn't just try to fully switch to Linux earlier. Because, did you know (since I already knew the basic bash language), that in order to set up a new Linux Mint machine, all I have to do, is run some scripts in the right order and do as the onscreen prompts I've designed, asks me to do. They are currently installed the Windows way, but it works for now. However, those scripts run in a certain order, and because of package managers, then my system is completely ready to go. It's great! I used to have to spend days doing the setup of things on Windows! Not to mention, until I fully document every step of the way, I can't completely set up any windows system! I will still support it on my network, but not recommend it maybe. Pretty cool now!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.