From: Artem Zolochevskiy <az@zolochevskie.net> To: community@lists.altlinux.org Subject: Re: [Comm] sh - bash Date: Sun, 15 Oct 2006 08:53:03 +0300 Message-ID: <egsifm$hdr$1@sea.gmane.org> (raw) In-Reply-To: <45316999.9080600@gmail.com> Pavel Usischev wrote: >> Собственно вопрос относительно написания скриптов >> Отчего же тогда вижу везде #!/bin/sh (в стартовых сценариях итп) - если >> этот sh такой старый и неумека? > > Как раз для переносимости скрипта. В ALT /bin/sh -- это особый вариант > bash, в других системах это вполне может быть другой шелл, а bash вообще > может отсутствовать. Так вот и я так думал, а получается, что нет. Ибо в альтовских скриптах (благодаря тому, что в альт sh это тот же bash) повсеместно используются фичи, кот в "оригинальном" sh не прокатят. Получается о совместимости тут речи нет. >> Ну и, если можно, пример можете привести где употребление >> #!/bin/sh или #!/bin/bash может сказаться на работоспособности скрипта. >> Т.е. какая такая фича может быть в скрипте, что при использовании >> #!/bin/sh он работать не будет. > > Об отличиях bash от изначального Bourne Shell можно почитать, дав команду: > > info bash 'Major Differences From The Bourne Shell' читали. собственно вопрос и возник от того что этих Differences не наблюдаю (ну вернее частично) > > Однако, насколько я понял, в ALT /bin/sh будет вести себя так же, как > /bin/bash (возможно, я просто как-то не так проверял). > вот здесь и засада. конкретный пример: bash: [artem@alt ~]$ A=5 [artem@alt ~]$ B=6 [artem@alt ~]$ C=$(($A+$B)) [artem@alt ~]$ echo $C 11 [artem@alt ~]$ альтовский sh: sh-3.1$ A=5 sh-3.1$ B=6 sh-3.1$ C=$(($A+$B)) sh-3.1$ echo $C 11 sh-3.1$ а по идее в sh это не должно прокатывать heirloom-sh: $ A=5 $ B=6 $ C=$(($A+$B)) syntax error: `C=$' unexpected $ Вот и получается что использование #!/bin/sh в альте явно не для совместимости. -- Artem Zolochevskiy Kaliningrad, Russia JID: az@jabber.org
next prev parent reply other threads:[~2006-10-15 5:53 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-10-14 21:57 Artem Zolochevskiy 2006-10-14 22:27 ` Alexey Rusakov 2006-10-15 5:41 ` Artem Zolochevskiy 2006-10-15 6:13 ` Alexey Rusakov 2006-10-15 8:41 ` Andrey Rahmatullin 2006-10-15 8:56 ` Artem Zolochevskiy 2006-10-15 9:03 ` Andrey Rahmatullin 2006-10-14 22:50 ` Pavel Usischev 2006-10-15 5:53 ` Artem Zolochevskiy [this message] 2006-10-15 5:57 ` Artem Zolochevskiy 2006-10-15 7:26 ` Sergey Vlasov 2006-10-15 7:43 ` Artem Zolochevskiy 2006-10-15 11:31 ` Dmitry V. Levin 2006-10-18 12:01 ` Fr. Br. George 2006-10-15 17:55 ` [Comm] heirloom toolchest Michael Shigorin 2006-10-15 10:55 ` [Comm] sh - bash Maksim Otstavnov 2006-10-15 17:52 ` Michael Shigorin 2006-10-15 17:48 ` Michael Shigorin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='egsifm$hdr$1@sea.gmane.org' \ --to=az@zolochevskie.net \ --cc=community@lists.altlinux.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Community general discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 community community/ http://lore.altlinux.org/community \ mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com public-inbox-index community Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.community AGPL code for this site: git clone https://public-inbox.org/public-inbox.git