Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
LECABashLib
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LECASofts
LECABashLib
Commits
c83c2254
Commit
c83c2254
authored
Mar 08, 2016
by
Eric Coissac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds the ifs package
parent
c2732536
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
ifs.sh
ifs.sh
+49
-0
No files found.
ifs.sh
0 → 100644
View file @
c83c2254
#
# LECA Bash library
#
# The LECA bash library provides a set of function used for helping
# development of bash script mainly to write job script on the luke
# cluster
#
# The files from the LECA Bash library must be sourced from your main script
#
include stack
newstack LECABASH_IFS_STACK
function
pushifs
()
{
if
[[
-z
"
${
IFS
}
"
]]
;
then
pushvalue LECABASH_IFS_STACK
"@@NULL@@"
else
local
v
=
$(
echo
-n
"
$IFS
"
| od
-b
| head
-n
+1 | sed
's/[0-9]* //'
| sed
's/ /\\/g'
| sed
's/^/\\/'
)
pushvalue LECABASH_IFS_STACK
"
$v
"
fi
if
[[
-z
"
$1
"
]]
;
then
unset
IFS
else
IFS
=
"
${
1
}
"
fi
}
function
popifs
()
{
local
v
v
=
$(
popvalue LECABASH_IFS_STACK v
)
if
[[
"
$?
"
!=
"0"
]]
;
then
if
[[
"
$v
"
==
"@@NULL@@"
]]
;
then
unset
IFS
else
IFS
=
$(
eval
"echo -n
\$
'
$x
'"
)
fi
else
return
1
fi
return
0
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment