One comment about set -x
If set in function, its scope does not end at the end of the function.
If there is a set +x at the end of a function, a return will bypass it.
The same applies for a loop. A break or continue bypasses a set +x at the end of the loop.
MIG, Yes...
I didnt post this output before - because I was too upset to, therefor you could not have known, sorry for that.
And that line 417 (if [ "$sum" -lt "$COLUMNS" ]) is of the printlist function.
Neither pick nor printlist are required to use printe, title and/or header -> yet that's been the only thing (pick) I was working on that day....
To where your set -x reference goes to.
But even with that error... the output is correct (at least the number-value thing).
Just 1 or 2 posts before the visual interface was working - but pick wasnt..
Now, none of the visual-output works.
It's exactly these kind of ('repeating') errors that are annoying and specialy frustrating when you had thought (and believed) you made it more robust....
Just to figure that it only worked within a bubble...
It was similar with TUI...
But there, it was the installation process.... which worked fine on all my machines when I had git-push'd it.
Just to then be non-working when I did try to install it a week later...
Over and over and over again....
My only mental-sanctuary on this topic is, that this time it is runtime only, so I wont need to use an 'installing' method per basic requirement.
Meanwhile, to my understanding/'feeling', this also makes it more 'vulnerable'...
I guess I wanted too much, too fast.
Yet, as soon the 'theme' is working again, I know everything will look nice again.
Thought, big part of my frustration comes from the memory of those 5 years working on this as TUI.
What I've achieved within the past ~2 months is not that bad.
Sure, there are still missing some parts, but as a whole, the CORE is (at least I thought so) working, and I do have alot of the nice-to-have functions ready.
And with 1 or 2 exceptions, those that are missing are done quite easily
Lets be 'honest', asRoot and pick are alot easier than a multiple-background-job-manager and a file-and-dir-browsing function that may use 'select' or 'read' and execute passed arguments to match dirs and files and arguments left to pass to the passed file, while reading and showing 'reserved keyword files' (the actual key-feature of SWARM -> the function swarm, which I havent even started yet to rework, because it relies on all other functions to be working stable.
Though, I might 'reserve' the background-job-manager for script-tools....
Also, I dont even know if other people are actualy interested in.
With TUI, I had ALOT of initial excitement at hand to compensate 'against' that uncertainty and keep motivation up.
Now I had started again, mostly because I still want 'it' working.
*nix to me, is scripting.
And scripting is what I love since my first i386 after I got aware of batchfiles and qbasic on MSDOS 5.
However, knowing that other people actualy would be interested to use it -> you know, making it more than just an ego-self-use-project <- would help to keep motivation up.
Or even better, would want to help me with the ACTUAL project I want to do -> Script-Tools.
SWARM is "just" a a 'side-product' of that project - so it (script-tools) can be realized as I imaged it.
Geez... it all started so simple and easy.
But the longer I 'worked' with *nix, the more complex my own 'demands and requirements' became.
On the other hand....
If I would be told by some people that this actualy IS a challenging task,
even for people with several years of coding and scripting experience, I would feel ALOT better about too.
I mean, I like to tell myself that it is.
As I'm not aware of other theme-able, multi-language supporting scripted project that support TTY and GUI support and have a 3-way interface between enduser, OS/machine and script-author -> then again, when properly done, 'one' (me) would not reckognize the difference (to compiled binary).
But as long nobody else says so, it feels like a self-induced-made-up-image.
Ok with just a text-code block it's not as 'impressive'...
So, here's an image:
Here's codeline 248-310 to illustrate that both 'output's are at the 'same location'.
Which is the absolute end of file of ./runtime
PHP Code:
#
# Starting SWARM now
#
source "$SWARMRC"
swarm.update.lang
swarm.update.lang.status
swarm.init.theme
#
# Initiate Interface
#
if [[ "./runtime" = "${0##/}" ]] || [[ "runtime" = "${0##/}" ]]
then # First time caller or arguments
if [[ -z "$1" ]]
then # First Time // No arguments
header --default
title "$SWARM_MSG_WELCOME_TITLE"
printe "$SWARM_MSG_WELCOME_INFOLINE1"
printe "$SWARM_MSG_WELCOME_INFOLINE2"
title "" # Separator
$ECHO "$SWARM_MSG_WELCOME_CONTENT" | printe -2 -- # "TODO: Visuals, then explain, configure and stuff..."
#status $? "one"
#init.countdown "Weee"
else # Has arguments, lets parse
case "$1" in
"basic")
shift
swarm.eu.show.basics
;;
"config")
shift
swarm.eu.show.config
;;
"help")
#echo hallo
shift
# Lets show a basic menu
swarm.eu.help.menu "${@}"
#break 2
;;
"tarball")
(
cd "${SWARM_DIR_ROOT}/.."
tar -acf "$HOME/swarm-${SWARM[BUILD]}.tar.gz" "${SWARM_DIR_ROOT##*/}"
)
;;
*) # Exit the loop
break
;;
esac
fi
fi
#
# Develeoper testings
#
if [[ "bash" = "${0/-}" ]]; then
#$ECHO " ----------- TEST AREA START -----------"
printe "Now it will work"
#set -x
# pick -m one two three four five six
#set +x
#$ECHO " ----------- TEST AREA END -----------"
fi"
Go figure, to me its 100% unclear.
EDIT:
As you (dont) see, all functions were loaded before the code segment above.
This is the source of my confusion, because both if-blocks come after all functions and variable definitions, regardless, when executed directly, the 'theme' seems not to work....
Unless it was also previously sourced, but it cant source itself, because this ends in an endless loop.
--> And that is exactly what I had thought to have just solved. <--
On the good side, I can keep trying to get pick working as intended, allthough I'll need to source the runtime first, once.
Writing this, brought up the idea of yet another 'improper' variable handling..
Maybe I'll need to check a variable check.
Question is, which one?
Theme's... again... seems kinda like it...
Maybe that parts needs a different handling wether it is sourced or executed?
It also indicates, in hindsight, that some 'left overs' have survived the 'cleanup' trap.
Good news!
Figured, all I missed was the swarm.update.geometry after the swarm.theme.init.
However, what I still dont understand is WHY.
Because swarm.update.geometry is called from within printe, which is used for most visual outputs.
Thus, to my understanding, it should not matter whether I call swarm.update.geometry there as well or not... Right?
And pick is working now too
I just need to start getting the help menu sorted....
Its a big mess as of now.. dont you think?
Specialy as the main functions (header, title printe, etc...) are not listed yet....
Next step is the input function and getting the help menu sorted.
After that, I hope it'll be ready for some test runs.
Oh well, was slightly too eager to say pick was done yesterday....
It's been a 'long story' frustrating issue as you could read here, and at "False positive grep?"
However, today we *cough* figured the cause of those issues and could fix it.
But, there was something more, because I had missed to redirect swarm.print.border >&2 and because of that, the returned value (as variable) contained empty spaces.
Some small preps for the help menu was all that i could achieve.
As it is WIP the 'look' (structure, approach) might change.
For today, lets see if I can get this to be more appealing to users.
Since preparing 'translatable' strings for functions is boring, I thought I'd implement some more functions from TUI.
What does one need, when one wants cross-platform-compatible scripts?
A way to reckognize and differ them of course!
If you happen to have any recomended additions or changes, please, let me know so.
Have fun!
Last edited by sea; 04-23-2020 at 12:50 PM..
Reason: code fix for swarm.os.distro
Hi,
I have shell script that I am running under Ubuntu as root.
Is it possible to hide the command window and show the user some sort of progress /random progress bar / or other form of GUI interaction?
On MAC, I have been using Platypus but on Ubuntu I am not sure what to do. (4 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Make a bash script that calculates average runtime for the first two scripts you made. The average should be... (17 Replies)
Hello,
My requirement is based on Oracle where we run a perl script and it asked some questions.I want to write a wrapper which will answer all these questions.
How is it possible.
Thanks (16 Replies)
Hi,
I am trying to capture runtime stats of a shell script (c shell). Are there system variables to call? Or should I create a date variable at the start of the script and at the end of the script? I am trying to capture the time if the script stops or ends with error.
Please help.
... (4 Replies)
Hi all,
Can I create multiple threads using single thread_id
like
pthread_t thread_id;
pthread_create(&thread_id, NULL, &print_xs, NULL);
pthread_create(&thread_id, NULL, &print_ys, NULL);
pthread_create(&thread_id, NULL, &print_zs, NULL);
pthread_join(thread_id, NULL);
what... (2 Replies)
Hello!
I would like to create a blog website on a web domain of mine. The blog will be used for publishing economics-lated articles.
I tried to use a few open source packages for blog creation (WorldPress, b2evolution, Movable type) which I wanted to test on a local computer before arranging... (5 Replies)
Hi Guys, I am trying write a wrapper script but I don't have any idea. I have 4 different korn shell scripts and all of them needs some parameters from command line (positional parameter). My script cant be interactive because its supposed to be automated. I am confused how can I write a wrapper... (6 Replies)
this is the output i am getting here..
cp: cannot create /wls_domains/eoigw/eoigwsA/deliv/cron/MailingScript/eoigwsA_Health_Status_Report.html: Permission denied
/wls_domains/eoigw/eoigwsA/deliv/cron/MailingScript/
/wls_domains/eoigw/eoigwsA/deliv/cron/MailingScript/GenerateReport.sh:... (6 Replies)