Skip to main content
11 events
when toggle format what by license comment
Apr 24 at 16:45 comment added Kevin Huntly yeah i noticed - i had var=foo in there and then i reloaded and re-ran and it printed, but having an array in there doesnt work. im not sure if i ever stated the goal - i have a websphere environment that has profiles, and more than one WAS server in each profile. since i cant do multiple %i's on a service, im trying to come up with the next best thing
Apr 24 at 16:23 comment added muru Huh, that completely changes the problem. What does your EnvironmentFile look like? Note that systemd only supports pretty simple assignment, no arrays or command substitution or other complex shell syntax
Apr 24 at 15:50 comment added Kevin Huntly There should have been a space between the command and the variable, I apologize for that and will update the question accordingly
Apr 24 at 15:04 comment added muru I don't see anything particularly unusual in that link. It's using a simple path for the executable (/usr/bin/etcd2) unlike your example in the question (/path/to/my-first-command-${SOME_VAR_DEFINED_IN_ENV_FILE})
Apr 24 at 14:59 comment added Kevin Huntly also, based on your initial response, the process identified by this link (flatcar.org/docs/latest/setup/systemd/environment-variables) shouldnt work - and that seems to be the experience im getting
Apr 24 at 14:58 comment added Kevin Huntly Understood, but if the EnvironmentFile is sourced, bash should be able to handle it, no? Alternately, is there a way to tell bash via /bin/bash -c 'source ${environmentfile} ...' ?
Apr 24 at 14:35 comment added muru No, systemd doesn't support arrays either.
Apr 24 at 13:29 comment added Kevin Huntly Ok, so - if I specify an EnvironmentFile directive (or Environment directive) as an array - let's say myArray=("val1" val2"), and then run /bin/bash -c 'for entry in ${myArray[*]}; do echo ${entry}; done' would I be able to reference that array variable if defined by Environment or within EnvironmentFile?
S Apr 22 at 16:31 history suggested Stanley Yu CC BY-SA 4.0
Add reference
Apr 22 at 16:30 review Suggested edits
S Apr 22 at 16:31
Apr 22 at 15:45 history answered muru CC BY-SA 4.0