이 문제는 a question posted to the Unix & Linux StackExchange community에 더 잘 포함되어 있습니다. 나는 키 누름에 여는 스크립트를 프로그래밍하고쉘 스크립트의 코드가 다른 작업 전에 실행됩니다.
, 새로운 터미널 (그놈 터미널)을 열고, scrot (스크린 샷 도구), 디렉토리에 임의의 이름과 사진을 저장 실행 pomf 그것을 업로드합니다. 고양이와 클립 보드에 대한 링크를 복사합니다.
잘 작동합니다. 현재 무엇을하려고하는지는 업로드가 완료되면 터미널을 닫는 것입니다.
내 스크립트가 다음과 같이 작동
바로 가기 (PrtScr) -> 그놈 터미널 -e "파이썬 경로에 /이/script.py"-> 시작 Scrot -> 파일 저장 (및 파일에 경로를 기억) -> bash script2.sh 경로/to/picture -> pomf.cat에 업로드 -> 링크 가져 오기 -> "xclip -selection clipboard"를 통해 클립 보드에 넣기
문자열을 넣은 후 터미널을 닫고 싶습니다. 클립 보드에 추가하면 다음과 같습니다.
eval $(printf $link | xclip -selection clipboard && sleep 1 && pkill terminal)
이 문제는 아무 것도 c로 복사되지 않습니다. 립 보드 및 터미널 닫힙니다. "& & 잠 1 & & pkill에 터미널"없이 그러나
, 링크가 복사하지만 터미널이 열려됩니다.
미리 감사드립니다.
// EDIT (실행 scrot에 대한)
첫 번째 스크립트 (스크린 샷을 업로드)
#!/usr/bin/env python
import os
import uuid
import time
def rstring(string_length=10):
random = str(uuid.uuid4())
random = random.upper()
random = random.replace("-","")
return random[0:string_length]
randomString = rstring(16)
os.system("scrot -s -q 100 /home/timon/screenshots/" + randomString + ".jpg")
while True:
processRead = os.popen("ps aux | grep \"scrot -s\" | cat").read()
if "scrot -s" not in processRead:
time.sleep(1)
else:
break
system.sleep(3)
os.system("/home/timon/.screenshot_stuff/./screen.sh /home/timon/screenshots/" + randomString + ".jpg")
두 번째 스크립트
#!/usr/bin/env bash
dest_url='https://cuntflaps.me/upload.php'
return_url='https://a.cuntflaps.me'
if [[ -n "${1}" ]]; then
file="${1}"
if [ -f "${file}" ]; then
printf "Uploading ${file}..."
my_output=$(curl --silent -sf -F files[]="@${file}" "${dest_url}")
n=0 # Multipe tries
while [[ $n -le 3 ]]; do
printf "try #${n}...\n"
if [[ true ]]; then
return_file=$(echo "$my_output" | grep "url" | sed 's/\,//g' | sed 's/\\//g' | sed 's/\"//g' | sed 's/\url://g' | tr -d ' ')
printf 'done.\n'
break
else
printf 'failed.\n'
((n = n +1))
fi
done
printf "$return_file" | xclip -selection clipboard && pkill terminal
else
printf 'Error! File does not exist!\n'
exit 1
fi
else
printf 'Error! You must supply a filename to upload!\n'
exit 1
fi
왜 '평가'가 필요합니까? – Leon
이것은 명령을 실행하기위한 것이지, 그렇지 않습니까? –
정확히는 아니지만, 귀하의 경우에 필요하지 않은 것으로 보이는 확장/대체의 추가 수준을 추가하기위한 것입니다. 사실 그것은 잘못 사용되기도합니다.'$ (...)'안에 명령의 출력을 명령으로 실행하려고 시도합니다. – Leon