Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
f5321df9
Commit
f5321df9
authored
15 years ago
by
rds
Browse files
Options
Downloads
Patches
Plain Diff
functions to maintain a variable as a space separated list with unique elements
parent
470c3abb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/zmap_functions.sh
+55
-0
55 additions, 0 deletions
scripts/zmap_functions.sh
with
55 additions
and
0 deletions
scripts/zmap_functions.sh
+
55
−
0
View file @
f5321df9
...
...
@@ -370,6 +370,61 @@ function zmap_remove_cluster_config
fi
}
# zmap_edit_variable_add & zmap_edit_variable_del are cover functions
# for zmap_edit_variable which adds or removes a string to the
# variable value as if the value is a space separated array.
# e.g. a list of files that must be removed.
# Usage: zmap_edit_variable_add VariableName VariableValue
function
zmap_edit_variable_add
{
zmap_edit_variable
$1
add
$2
}
# Usage: zmap_edit_variable_del VariableName VariableValue
function
zmap_edit_variable_del
{
zmap_edit_variable
$1
remove
$2
}
# Usage: zmap_edit_variable VariableName [add|remove] VariableValue
function
zmap_edit_variable
{
name
=
$1
add_remove
=
$2
value
=
$3
eval
"VARIABLE=
\$
{
$name
}"
eval
"VARIABLE_OUT="
#echo "$name=$VARIABLE"
for
part
in
$VARIABLE
do
if
[
"x
$part
"
!=
"x
$value
"
]
;
then
if
[
"x
$VARIABLE_OUT
"
!=
"x"
]
;
then
VARIABLE_OUT
=
"
$VARIABLE_OUT
$part
"
else
VARIABLE_OUT
=
"
$part
"
fi
fi
done
if
[
"x
$add_remove
"
==
"xadd"
]
;
then
if
[
"x
$VARIABLE_OUT
"
!=
"x"
]
;
then
VARIABLE_OUT
=
"
$VARIABLE_OUT
$value
"
else
VARIABLE_OUT
=
"
$value
"
fi
fi
#echo "variable out = '$VARIABLE_OUT'"
eval
$name
=
'$VARIABLE_OUT'
}
# Usage: zmap_trap_handle
function
zmap_trap_handle
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment