I have a bash file:
#!/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
name=$(<$OUTPUT)
curl -d '{"query":"developer", "turnOff":true}' -H "Content-Type: application/json" -X POST http://localhost:8080/explorer
in last string (curl command) I want to set variable name instead "developer". How to correctly insert it?
OUTPUT=$(mktemp). It will create a unique file (sth. like/tmp/tmp.RyR3UlsV5c). However, you will still need to delete it manually, like you already do.mktempcreates such a file and returns (prints) its filename. – PerlDuck Aug 31 '18 at 12:55