Skip to content

NW | 2026-mar-sdc | Zabihollah Namazi | Sprint 1 | individual-shell-tools-exercises#365

Open
ZabihollahNamazi wants to merge 14 commits intoCodeYourFuture:mainfrom
ZabihollahNamazi:ZabihollahNamazi-individual-shell-tools
Open

NW | 2026-mar-sdc | Zabihollah Namazi | Sprint 1 | individual-shell-tools-exercises#365
ZabihollahNamazi wants to merge 14 commits intoCodeYourFuture:mainfrom
ZabihollahNamazi:ZabihollahNamazi-individual-shell-tools

Conversation

@ZabihollahNamazi
Copy link
Copy Markdown

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

I have done the tasks and please if you could check them , thanks

@ZabihollahNamazi ZabihollahNamazi added 📅 Sprint 1 Assigned during Sprint 1 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 13, 2026
@SlideGauge SlideGauge added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Apr 6, 2026

# TODO: Write a command to output the contents of the helper-1.txt file inside the helper-files directory to the terminal.
# The output of this command should be "Once upon a time...".
cyf@MacBookPro individual-shell-tools % cat helper-files/helper-1.txt
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen if I try to execute this script as it is written right now? with cyf@MacBookPro etc?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wont work and i fixed it
thanks

# It looked delicious.
# I was tempted to take a bite of it.
# But this seemed like a bad idea...
cyf@MacBookPro individual-shell-tools % cat helper-files/helper-*.txt
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, what will happen if I try to execute this script as it is written right now? with cyf@MacBookPro etc?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wont work and i fixed it
thanks

# 1 It looked delicious.
# 2 I was tempted to take a bite of it.
# 3 But this seemed like a bad idea...
cyf@MacBookPro individual-shell-tools % cat -n helper-files/helper-3.txt
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, what will happen if I try to execute this script as it is written right now? with cyf@MacBookPro etc?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wont work and i fixed it
thanks

# 3 It looked delicious.
# 4 I was tempted to take a bite of it.
# 5 But this seemed like a bad idea...
cyf@MacBookPro individual-shell-tools % cat helper-files/* | nl -v 1 -n ln
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen if I try to execute this script as it is written right now? with cyf@MacBookPro etc?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wont work and i fixed it
thanks


# TODO: Write a command to output every line in dialogue.txt said by the Doctor.
# The output should contain 6 lines.
grep '^Doctor:' dialogue.txt
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct! It distinguishes Doctor lines from usual lines just having "Doctor" in it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

# TODO: Write a command which lists the files in the child-directory directory, one per line, sorted so that the most recently modified file is first.
# The output should be a list of names in this order, one per line: helper-3.txt, helper-1.txt, helper-2.txt.

ls % ls -1t child-directory
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if I try to execute the script with ls % part?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it gives me this:
cyf@MacBookPro ls % ls % ls -1t child-directory
ls: -1t: No such file or directory
ls: %: No such file or directory
ls: ls: No such file or directory
child-directory:
helper-1.txt helper-2.txt helper-3.txt

and i fixed it , thanks


# TODO: Write a command to output the name of every `.txt` file in this directory which contains a line of dialogue said by the Doctor.
# The output should contain two filenames.
grep -h '^Doctor:' dialogue*.txt
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen when we pass -h command line argument? Is it what we want to achieve in this task?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-h hides the file name
the correct one is -l to show the file names and i fixed it ,thanks

# TODO: Write a command to output the total of adding together all players' first scores.
# Your output should be exactly the number 54.
awk '{
for(i=3;i<=3;i++) total += $i
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How many times this loop is going to be executed? Taking the answer into account, which benefits does the loop grant us here, if any?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runs once per line
this way is good to do with several columns but i made it simpler ,thanks

# TODO: Write a command to output just the names of each player along with the total of adding all of that player's scores.
# Your output should contain 6 lines, each with one word and one number on it.
# The first line should be "Ahmed 15". The second line should be "Basia 37"
awk '{sum=0; for(i=3;i<=NF;i++) sum += $i; print $1, sum}' scores-table.txt
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct start from 3, skipping unnecessary fields, like!

@SlideGauge
Copy link
Copy Markdown

Could you address my notes please? Thanks!

@SlideGauge SlideGauge added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 6, 2026
@ZabihollahNamazi ZabihollahNamazi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 8, 2026
@SlideGauge
Copy link
Copy Markdown

Good job, review complete

@SlideGauge SlideGauge added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants