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
Christopher Cottier
bash-scripting-assignment
Commits
fac70d59
Commit
fac70d59
authored
Mar 27, 2021
by
vagrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working on problem 5
parent
8f4e0d58
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1297 additions
and
0 deletions
+1297
-0
5-generate-report.sh
responses/5-generate-report.sh
+38
-0
timesheet.csv
responses/timesheet.csv
+1259
-0
No files found.
responses/5-generate-report.sh
0 → 100755
View file @
fac70d59
#!/bin/bash
timesheet
=
"
$(
pwd
)
/timesheet.csv"
#sort timesheet by customer
#sum of each customer
currentCustomer
=
""
sum
=
0
#infinite loop rn
sort
-t
","
-k5
$timeshet
|
while
read
-r
line
do
customer
=
$(
echo
$line
|
cut
-d
","
-f5
)
billable
=
$(
echo
$line
|
cut
-d
","
-f7
)
hours
=
$(
echo
$line
|
cut
-d
","
-f8
)
echo
$customer
if
[
$customer
!=
$currentCustomer
]
then
#echo $currentCustomer
#echo $sum
currentcustomer
=
$customer
sum
=
0
fi
if
[
$billable
==
"Y"
]
then
sum
=
$((
sum
+
hours
))
fi
done
#final print sum
echo
$currentCustomer
echo
$sum
responses/timesheet.csv
0 → 100644
View file @
fac70d59
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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