Linux · Bash Scripting

You want to drop a couple of lines into a new script file but don't want to open an editor. How can you do it with cat, and how do you signal you're done typing?

Answer locked. Get the free KnowCard app to reveal it — plus spaced-repetition review so it actually sticks.

Get it on App StoreGet it on Google Play

This is one card from the KnowCard library — thousands more across SAP, Linux, Python and more. In the app you get the answer, AI explanations, and cards that come back right before you would forget them. Free to start on iOS, Android or the web.

More in Bash Scripting

Beyond just replaying a fixed command sequence, what capabilities make a bash script a real programming language rather than a glorified alias?
You wrote a script whose first line is #!/bin/bash. What is that line called, and what does the kernel actually do with it when you run the file?
Your script's shebang says #!/bin/sh instead of #!/bin/bash. On Debian and Ubuntu, why might a working script suddenly break under that shebang?
Inside a script, how do you reach the first argument the user typed on the command line, and why does this beat a plain alias?
You just wrote a new script file, but running ./myscript gives 'permission denied'. Which access bit is missing, and why does read access alone not fix it?
You're tired of typing ./ in front of your script every time. What has to be true so you can call it by bare name from anywhere, and where do you put it?

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play