Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bash-scripting-assignment
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Arndt
bash-scripting-assignment
Commits
03dde3cd
Commit
03dde3cd
authored
Mar 29, 2021
by
vagrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BSA-00] (ArndtED) Adds Mr. Alim's solution to 5
parent
2e2a1181
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
solution5
bash-scripting/solution5
+19
-1
No files found.
bash-scripting/solution5
View file @
03dde3cd
...
...
@@ -2,4 +2,22 @@
PARENT_PATH
=
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
;
pwd
-P
}
)
echo
$PARENT_PATH
[[
-z
$1
]]
&&
echo
"No input arguments provided"
&&
exit
1
declare
-A
projects
total
=
0
while
read
LINE
do
IFS
=
,
read
start end name email projectId country billFlag hours
<<<
"
$LINE
"
if
[[
$billFlag
==
"Y"
]]
;
then
projects[
$projectId
]=
$((
${
projects
[
$projectId
]
}
+
$hours
))
total
=
$((
$total
+
$hours
))
fi
done
<
$1
printf
"%-20s %6s
\n
"
"Project"
"Hours"
for
projectId
in
"
${
!projects[@]
}
"
do
printf
"%-20s %6s
\n
"
"
$projectId
"
"
${
projects
[
"
$projectId
"
]
}
"
done
printf
"%-20s %6s
\n
"
"Total"
"
$total
"
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