Morning, gang,
I'm attempting to tidy-up some of my portable-browser 'LAUNCH' scripts by using the case statement. At present, depending on the Puppy in question, various options - including whether the included 'lib' directory is required or not - are handled by long strings of "if....then....else" statements. In many cases, the required command (plus "switches) for the Chromium-based browsers is identical, and doesn't really need to be duplicated over & over again (AND again!).....but of course, we all work within the limits of our personal knowledge.
So; to the object of this query. The executable command + option "--switches" for, say, Brave-portable looks like this:-
Code: Select all
run-as-spot "$HERE/brave/brave" --user-data-dir=$HERE/PROFILE/spot/Brave-Browser --disk-cache-size=50000000 --media-cache-size=50000000 --allow-outdated-plugins --force-device-scale-factor=1.2
This same identical executable line is presently duplicated multiple times. How could I go about assigning this entire line of code to a single variable?
I'm assuming brackets are required, but.....which ones? Round ("()"); square ("[]"); curly ("{}")? Single.....or double? What would be the simplest way to achieve the desired outcome.....so that a single variable would execute that entire line of code?
(I know how to assign single statements/expressions/commands to a variable, but I'm not sure how you go about assigning not just a command but also a bunch of options all at the same time... Can it BE done? Would it then work as desired?)
Obviously, part of one's Bash 'journey' involves learning new ways of doing things as you progress.....but a few "pointers" would be appreciated! Many of the online Linux tutorial blogs don't make a lot of this stuff very clear.
.....or perhaps I'm jumping in at the deep end without first learning the basics.... (*shrug...*)
TIA.
Mike.