Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a bash scripts that are one line long. You can ONLY use a one pipeline com

ID: 3849520 • Letter: W

Question

write a bash scripts that are one line long. You can ONLY use a one pipeline command to get the solution. You may not use control structures, multiple lines, or anything that goes beyond this restriction. You are allowed to use pipelines, command substitution, and script arguments.

Question: Print out a file with line numbers, BUT the numbers are descending NOT ascending. Here is an example:

So when you run your your bash script it should print it like this

$ "bash script" Hello.txt

3 Hello
2 my
1 friends
$

Do nothing for no inputs

You can use cat in your solution, but you cannot use any options with it. You will involve pipelines and command substitutions and maybe ‘-’ metacharacter.

Explanation / Answer

tac command is used to reverse the file.

first reverse the file then number it and again reverse the file.

it think it may work.

tac hello.txt | nl | tac hello.txt.