小编Val*_*kyi的帖子

如何在bash中的curl命令中设置变量?

我有一个 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)

command-line scripts curl

18
推荐指数
4
解决办法
8万
查看次数

cp:无法创建常规文件:只读文件系统

我有一个可启动闪存卡(带有 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)

filesystem read-only cp

6
推荐指数
1
解决办法
6万
查看次数

如何在使用 bash 脚本的 curl 命令中设置布尔值

我需要设置为变量 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接受值malefemale如何将适当的布尔值设置为sex变量?

bash json

3
推荐指数
1
解决办法
4352
查看次数

标签 统计

bash ×1

command-line ×1

cp ×1

curl ×1

filesystem ×1

json ×1

read-only ×1

scripts ×1