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
80558c9b
Commit
80558c9b
authored
Mar 27, 2021
by
vagrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
problem 5 solved, but total still needed
parent
fac70d59
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
5-generate-report.sh
responses/5-generate-report.sh
+11
-13
total.data
responses/total.data
+0
-0
No files found.
responses/5-generate-report.sh
View file @
80558c9b
#!/bin/bash
timesheet
=
"
$(
pwd
)
/timesheet.csv"
timesheet
=
$1
#sort timesheet by customer
#sum of each customer
currentCustomer
=
""
sum
=
0
total
=
0
echo
"Customer : Hours"
#infinite loop rn
sort
-t
","
-k5
$timeshet
|
while
read
-r
line
sort
-t
","
-k5
$timesheet
|
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
]
if
[
"
$customer
"
!=
"
$currentCustomer
"
]
then
#echo $currentCustomer
#echo $sum
current
customer
=
$customer
echo
"
$currentCustomer
:
$sum
"
total
=
$((
$total
+
$sum
))
current
Customer
=
"
$customer
"
sum
=
0
fi
if
[
$billable
==
"Y"
]
if
[
"
$billable
"
==
"Y"
]
then
sum
=
$((
sum
+
hours
))
sum
=
$((
$sum
+
$
hours
))
fi
done
#echo "Total : $total"
#final print sum
echo
$currentCustomer
echo
$sum
responses/total.data
0 → 100644
View file @
80558c9b
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