Need help with Shell Script, GREP, KMVAR
After 1.5 days, help is requested. I think my goal is working in the first Execute shell script to select 5 character words that do not have a letter in a specific position. but I want to change the pattern through different letters in different word positions hence my attempt at using a KMVAR in the second execute shell script.
thanks for the help.
Grep test.kmmacros (31 KB)
In your last Execute action, I don't see any words that have an "a" in the second position. Therefore the grep command returns nothing. Therefore, I think, (not sure why) you get an error. You can turn off errors for that action using the cogwheel, and then execution should continue and you should be fine.
you may be running into the elipses character, depending on your settings, macOS might be set to replace 3 "." characters with the "…" character.
If you scroll up through that list the first three words have an 'a' in the second position.
That's an excellent point. Every time I get a new computer I turn that option off in my System Settings because it harms programmers. Basically, everyone should turn off these options...
Yes! I've been burned a few too many times by those "smart quotes" and other character replacements.
Okay. I'm pondering it. I'm struggling to find the right answer. Maybe someone will beat me.
this is a good thought which has tripped me up before. if you open the macro and edit the search string there are 3 periods that can be deleted as opposed to one ellipse. unless something is translating the 3 periods at the 2nd shell script? I do have that turned off in macOS settings. also the first shell script does work.
I'm 80% sure the indirect cause is that your shell is interpreting the dots as file wildcards. I'm working on it.
this works on my system:
Is "include all variables" checked in this menu?
That's probably his problem.
where is the "include all variables" and what does it mean. I thought Var3 was just one variable.
so Var3 to KM is one variable but "$KMVAR_Var3" translated by shell/grep is 5?
I don't understand your question. Try making the change and see if it works.
yes that works. can you tell me what variables were not included in the second shell script as opposed to the first shell script?
I would have to read the KM manual. This is a new feature.
The default appears to be "Include all" but it appears you somehow changed that, therefore Var3 was not being passed to the shell.
You can find out which variables were passed by replacing your grep command with "env" which, I think, will list all variables in the environment.
can you tell me where the global default "include all" would be changed? on the first shell script "include all variables" is not selected. sorry I am just trying to understand how I did this or did not understand this in any documentation.
The default should be "Include all variables" I'm not sure how that would have gotten changed if you hadn't set it differently. That is a new menu/setting in KM 11 and it's included in the wiki documentation on the Execute Shell Script action.