Conventions for sed script?

I know it doesn't matter which file extensions are on Linux, but what is the convention for naming sed scripts? I saw both .sh, .sed, .sd

+4
source share
2 answers

Use .sh when the file contains shell commands; use .sed when it only has sed -f commands and sed -f loads.

For example, call script.sh :

 #!/bin/sh sed 's/foo/bar/g' 

For now, this will be script.sed :

 s/foo/bar/g 

Editors like Vim will provide you with the correct highlighting based on .sh and .sed .

+3
source

The convention will most likely not put the "extension" in sed scripts.

In unix, a file is a file. There is no such thing as an extension. Extensions are a dialect of FAT file systems and are used only on unix by people who have not completely transferred their thinking from the world of DOS / Windows.

Name your files what they are. Their content speaks for itself.

+2
source

Source: https://habr.com/ru/post/1398464/


All Articles