Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/startami
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ ami_path=$ami_base_path$(grep ami_GUI_path /reg/g/pcds/dist/pds/"$HUTCH"/scripts
proxy_cds=$(/reg/g/pcds/dist/pds/"$HUTCH"/current/tools/procmgr/procmgr status /reg/g/pcds/dist/pds/"$HUTCH"/scripts/"$CONFIG" | grep ami_proxy | awk '{print $1}' | sed s/'-fez'/''/g)

amicmd=$(grep ami_client /reg/g/pcds/dist/pds/"$HUTCH"/scripts/"$CONFIG" | grep -v '#' | awk 'BEGIN { FS = ":" }; { print $4}' | sed s/ami_GUI_path//g | sed s/\'+proxy_cds/"$proxy_cds"/g | sed s:\'+expname:"$EXPNAME"/:g | sed s/+\'//g | sed s/\'\}\)//g)
# Strip trailing cnf/python artifacts (e.g. "})") so eval doesn't choke
amicmd=$(printf "%s" "$amicmd" | sed 's/[[:space:]]*[})][})]*$//')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicky questions, if this works I think it's correct to merge without addressing these.
I'm mostly trying to update my own sed/regex knowledge.

  • Why is this a new command using printf instead of joining onto the | sed train on line 74?
  • (Conversely, if new commands are preferred for readability, maybe we should unwrap more of them)
  • Why printf with no formatting over echo?
  • What's [[:space:]]* doing in the sed here? Are you expecting e.g. })? Your PR description only mentions })
  • It looks like you're using a literal [})] followed by a [})]*, but in regex we have a + operator for matching 1 or more instances of a symbol. This could have been [})]\+


if [[ "$DAQHOST" == *"$HOSTNAME" ]]; then # Check host and daq host line share host name...
#running on the DAQ host, this will restart the ami_client!
Expand Down