-
-
Notifications
You must be signed in to change notification settings - Fork 11
LONDON | DONARA BLANC | MODULE TOOLS | SPRINT 2 | JQ exercises #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ set -euo pipefail | |
# The input for this script is the person.json file. | ||
# TODO: Write a command to output the name of the person, then a comma, then their profession. | ||
# Your output should be exactly the string "Selma, Software Engineer", but should not contain any quote characters. | ||
q -r '[.name, .profession] | join (",")' person.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like something went slightly wrong in your copy+paste here? But this raises an interesting workflow question - there are two ways you can go about making this kind of script - you can work in the terminal then copy+paste into the file, or work in the file and run the file each time you want to try something out. How do you feel about the two? What are the advantages/disadvantages of each way of working? |
||
Selma,Software Engineer |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,11 @@ set -euo pipefail | |
# The input for this script is the scores.json file. | ||
# TODO: Write a command to output the names of each player, as well as their city. | ||
# Your output should contain 6 lines, each with two words on it. | ||
jq -r '.[] | "\(.nam | ||
e) \(.city)"' scores.json | ||
Comment on lines
+8
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How did you end up with a newline in the middle of your command here? (Same for script-06 and script-07, script-10, and script-11)? |
||
Ahmed London | ||
Basia London | ||
Mehmet Birmingham | ||
Leila London | ||
Piotr Glasgow | ||
Chandra Birmingham |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is useful to see the output produced, but we'd generally avoid putting this directly in a shell script, as it causes the script to no longer run, e.g.
If you're going to include the output, I'd recommend doing so in a comment (i.e. putting a
#
before the output) so that the scripts can still run :)