首页 > 系统相关 >Linux shell script shebang env All In One

Linux shell script shebang env All In One

时间:2023-05-03 16:12:04浏览次数:32  
标签:bin shell shebang script exit usr env bash

Linux shell script shebang env All In One

指定 shell script 的运行环境

shell script shebang env

hash bang env

#!\usr\bin\env bash

#!\usr\bin\env bash
# ❌

#!/usr/bin/env

#!/usr/bin/env bash
✅

demos

image

image

#!/usr/bin/env bash
# ✅

export N=1
# case 1 数字
# suceess exit ✅

# ✅
case "$N" in
  1)
    echo 'case 1 数字';;
  2)
    echo 'case 2 数字';;
  *)
    echo 'default case 数字 *'
    echo 'error exit ❌'
    exit 1
  ;;
esac

echo 'suceess exit ✅'
exit 0

(

标签:bin,shell,shebang,script,exit,usr,env,bash
From: https://www.cnblogs.com/xgqfrms/p/17369184.html

相关文章

  • Linux shell script switch...case All In One
    Linuxshellscriptswitch...caseAllInOnecase...in...esaccase...esac为多选择语句,与其他语言中的switch...case语句类似,是一种多分支选择结构;每个case分支用右圆括号开始,用两个分号;;表示break,即执行结束,跳出整个case...esac语句,esac(就是case反过......
  • PowerShell-自定义的配置文件
    PowerShell5.1一般Windows10自带的是这个版本的PowerShell,这个版本的自定义配置文件的文件编码要保存为ANSI才行。PowerShell7这个是通过github另外下载的,这个版本的自定义配置文件的文件编码要保存为utf-8才行。 配置文件代码其实也没啥,主要加了一个时间显示和我可能用......
  • xshell下上传文件无法上传,速度一直为0的解决方法
    连接服务器cd切换到主目录执行以下命令如果在xshell下上传文件速度一直为0,可以尝试安装yum -yinstalllrzsz......
  • typescript重写canvas --7.利用clip在指定区域绘图
    typescript重写canvas--7.利用clip在指定区域绘图1.使用canvas利用clip在指定区域绘图<!DOCTYPEHTML><html><head><metacharset="utf-8"/></head><body><canvasid="myCanvas"width="250"height="200......
  • 简单总结JavaScript中的微任务和宏任务
    在JavaScript中,任务被分为宏任务和微任务。宏任务:常见的宏任务有setTimeout、setInterval、I/O、UI渲染等等。这些任务都是由浏览器或Node.js中的事件循环调度执行的,它们会被放入一个任务队列(taskqueue)中,等待执行。微任务:常见的微任务有Promise、MutationObserver等。......
  • windows powershell
    路径:C:\Users\Thinkpad\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1内容:#regioncondainitialize#!!Contentswithinthisblockaremanagedby'condainit'!!(&"D:\Miniconda3\Scripts\conda.exe""shell.......
  • [Javascript] avoid mutation: Array.prototype.toSpliced() vs splice()
    Array.prototype.splice()mutatestheoriginalarray.Toavoidmutation,weuseArray.prototype.slice().newmethodArray.prototype.toSpliced()returnanewarraytoavoidthemutation.constmonths=["Jan","Mar","Apr",&quo......
  • [Javascript] Avoid mutation, Array.prototype.toSorted() vs sort()
    sort(),mutatestheoriginalarray,andreturnthereferencetooriginalarrayandsorted.The toSorted() methodof Array instancesisthe copying versionofthe sort() method.Itreturnsanewarraywiththeelementssortedinascendingorder.const......
  • [Javascript] Avoid mutation, Array.prototype.toReversed() vs reverse()
    reverse()mutatestheoriginalarray,returnthereferencepointtotheoriginalarray.The toReversed() methodof Array instancesisthe copying counterpartofthe reverse() method.Itreturnsanewarraywiththeelementsinreversedorder.constite......
  • [Javascript] Array.prototype.with
    Prevously,whenwewanttoupateaniteminsideaarray:constitems=[{id:1,name:'a'},{id:2,name:'b'},{id:3,name:'c'},{id:4,name:'d'},{id:5,name:'e'}]constnewIt......