我有一个 bash 文件:
#!/bin/bash
# yesnobox.sh - An inputbox demon shell script
OUTPUT="/tmp/input.txt"
# create empty file
>$OUTPUT
# cleanup - add a trap that will remove $OUTPUT
# if any of the signals - SIGHUP SIGINT SIGTERM it received.
trap "rm $OUTPUT; exit" SIGHUP SIGINT SIGTERM
# show an inputbox
dialog --title "Inputbox" \
--backtitle "Search vacancies" \
--inputbox "Enter your query " 8 60 2>$OUTPUT
# get respose
respose=$?
# get data stored in $OUPUT using input redirection …
Run Code Online (Sandbox Code Playgroud) 我有一个可启动闪存卡(带有 acronis(不是我的安装)),我可以读取但无法将文件复制到其中。当我使用 Windows 时,没有任何问题,但我无法在 ubuntu 中使用此卡 - 只读文件系统出现错误
~ $sudo cp -f vbinst.sh /media/valeriy/TERMINAL/
[sudo] password for valeriy:
cp: cannot create regular file '/media/valeriy/TERMINAL/vbinst.sh': Read-only file system
$ sudo fdisk -l
Disk /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical):
512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096
bytes Disklabel type: gpt Disk identifier:
9F6D513D-4906-4670-9DF3-57280CEF2E8B
Device Start End Sectors Size Type
/dev/sda1 2048 3905535 3903488 …
Run Code Online (Sandbox Code Playgroud) 我需要设置为变量 true/false 值并使用curl
命令将他发送到 json 中:
name=$1
sx=$2
`curl -d '{"name":"'"$name"'", "sex":true}' -H "Content-Type: application/json" -X POST http://localhost:8080/setacc`
Run Code Online (Sandbox Code Playgroud)
变量sx
接受值male
或female
如何将适当的布尔值设置为sex
变量?