便携式舍邦线

发布于 2024-09-02 03:12:23 字数 212 浏览 1 评论 0原文

#!/usr/bin/perl

这是我最近写的很多剧本的主线。

对二进制文件的路径进行硬编码似乎可能会产生一些问题。例如,如果我的一个用户在 /something_else/bin 安装了 Perl,那么他们必须更改所有的 shebang。

我见过一些可以自动替换 s​​hebangs 的工具,但我想知道是否有更简单的东西。

#!/usr/bin/perl

This is the shebang line to a lot of scripts I'm writing lately.

Hard coding the path of the binary seems like it could create some problems. For instance, if one of my users has Perl installed at /something_else/bin then they'd have to change all the shebangs.

I've seen some tools that will automatically replace the shebangs, but I'm wondering if there is something simpler.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情绪操控生活 2024-09-09 03:12:23

env(1)

#!/usr/bin/env perl

env(1)

#!/usr/bin/env perl
淡笑忘祈一世凡恋 2024-09-09 03:12:23

对于 env 不在 /usr/bin/env 中的奇怪嵌入式系统(例如运行 funplug 等的 NAS 盒子),这可能有效。基于 ActivePerl / DOS 技巧

#!/bin/sh
exec perl -x -S "$0" "$@"
#!perl
print "hello";

For odd embedded systems where env is not in /usr/bin/env (E.g. NAS boxes running funplug etc) this might work. Based on the ActivePerl / DOS trick

#!/bin/sh
exec perl -x -S "$0" "$@"
#!perl
print "hello";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文