PostgreSQL - How do I break up long commands?

So I’m doing the Learn SQL By Building a Student Database: Part 2 and I’m at a point where the needed command spans my entire screen:

echo -e "\nMajor ID, total number of students in a column named 'number_of_students', and average GPA rounded to two decimal places in a column name 'average_gpa', for each major ID in the students table having a student count greater than 1:"

Is there any way I can break this up into smaller portions for readability’s sake. I’ve tried looking around StackOverflow and I found one that says to use ‘\’ but that didn’t work.

Would appreciate any help.

As far as I remember, this echo statement should go into the script file rather than the bash terminal.

If you still want to get the output on the terminal, you can continue to the next line as it is. That worked for me:

Hey zaira_h,
Thanks for the reply. I can’t believe I didn’t think of treating it as string.

My write up looks more readable now. Thanks for the tip.



1 Like