How do you suffix the end of a bash file?

I know that this is probably me dumb, but here's what bothers me:

  • What suffixes are called at the end of the file? i.e...txt, .php, .html, etc.

  • What suffix does the bash? .Bash file use?

Thank you for helping my stupidity be no more.

+4
source share
4 answers

These are called file extensions. By convention, shell scripts, including Bash scripts, get the extension .sh(for a "shell script").

Please note that this is not a prerequisite for executing the script. You can leave it or give it another file extension (for example, .bashrcfor example, to initialize the Bash script by default), and it will still work anyway.

+3

unixoid (, GNU/Linux) " " ( ) , . , , , ...

shell- ".sh", .

, : script "shebang" (#!/bin/bash). script ( ), , (). , , ( "x-bit" ) , unixoid-. , > /path/to/script (> script), , PATH.

+2

Unix , .

Windows , . Unix shebang. script #!, :

#! /usr/bash    # Will execute with the default BASH shell

:

#! /usr/bin/env foo

, foo , /usr/bin/env foo foo . , Perls, , $PATH. Perl:

#! /usr/bin/env perl

Perl.


...

Unix, Unix, shebang, . , Unix. , Mac OS X (, Unix) Finder , ( ).

Linux Gnome ( Nautilus) . , Konqueror ( KDE). , . , .

, .sh script, Bourne, BASH, Kornshell, Zsh, Ash, Dash , , Bourne. .bash, .ksh .zsh, .

+1

(!) , : .sh bash . : .sh sh .

, ? , script Bash, Perl Python? .elf?

Bash Guide Lhunath GreyCat :

, , , .sh. ( bash script, sh script).

bash :

file /bin/* | grep Bourne

:

/bin/gunzip:                  Bourne-Again shell script, ASCII text executable
/bin/gzexe:                   Bourne-Again shell script, ASCII text executable
/bin/init-checkconf:          Bourne-Again shell script, ASCII text executable
/bin/uncompress:              Bourne-Again shell script, ASCII text executable
/bin/zcat:                    Bourne-Again shell script, ASCII text executable
/bin/zcmp:                    Bourne-Again shell script, ASCII text executable
/bin/zdiff:                   Bourne-Again shell script, ASCII text executable
/bin/zegrep:                  Bourne-Again shell script, ASCII text executable
/bin/zfgrep:                  Bourne-Again shell script, ASCII text executable
/bin/zforce:                  Bourne-Again shell script, ASCII text executable
/bin/zgrep:                   Bourne-Again shell script, ASCII text executable
/bin/zless:                   Bourne-Again shell script, ASCII text executable
/bin/zmore:                   Bourne-Again shell script, ASCII text executable
/bin/znew:                    Bourne-Again shell script, ASCII text executable

, , !

+1

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


All Articles