Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shell: read a file and echo it's contents to another file

Tags:

shell

I have a Makefile that is supposed to echo aliases from another file to your local .zshrc file.

I need to read the contents of the file aliases.sh, and echo it's contents to ~/.zshrc, how is this possible?

like image 203
beakr Avatar asked Jun 02 '12 13:06

beakr


People also ask

How do I redirect an echo to a file?

$ echo “Hello” > hello. txt The > command redirects the standard output to a file. Here, “Hello” is entered as the standard input, and is then redirected to the file **…

How do I copy content from one file to another?

You need to use the cp command. It is used to copy files and directories. The copies become independent of the originals. Any subsequent change in one will not affect the other.

How do I copy content from one file to another in Linux?

The Linux cp command is used for copying files and directories to another location. To copy a file, specify “cp” followed by the name of a file to copy. Then, state the location at which the new file should appear. The new file does not need to have the same name as the one you are copying.


1 Answers

cat aliases.sh >> ~/.zshrc
like image 98
Ankur Avatar answered Sep 24 '22 15:09

Ankur