Sorry for the confusing title but herВs what I want to do.
I run this command прекратился often:
w3m -dump http://www.example.com/file-to-save-as-text/ > ~/Desktop/saved-file.txt
Is it possible to have в (Zenity?) or plain конечный рукописный шрифт that will allow to пас in the унифицированный указатель ресурса http://www.example.com/file-to-save-as-text/
and then prompt я to type in just the file ямс such схвати saved-file.txt
after which w3m
will "dump" the унифицированный указатель ресурса contents in ~/Desktop
with the file ямс I specified?
In other words, instead of typing in the whole command, гll just need to пас in the унифицированный указатель ресурса (copied from my browser's address бар) and provide в suitable file ямс.
Можно использовать этот сценарий:
#!/bin/bash
url="$(zenity --entry "URL" --title "Enter the URL:" --text "Enter the URL:" 2>/dev/null)"
filename="$(zenity --entry "filename" --title "Enter the filename:" --text "Enter the filename:" 2>/dev/null)"
w3m -dump "$url" > ~/Desktop/"$filename"
url="$(zenity --entry "URL" --title "Enter the URL:" --text "Enter the URL:" 2>/dev/null)"
: подсказки для URL и хранилищ вход в $url
; filename="$(zenity --entry "filename" --title "Enter the filename:" --text "Enter the filename:" 2>/dev/null)"
: подсказки для имени файла и хранилищ вход в $filename
; w3m -dump "$url" > ~/Desktop/"$filename"
: выполняет w3m -dump
на $url
и перенаправляет вывод к ~/Desktop/"$filename"
. Вы могли использовать что-то вроде этого:
#!/bin/bash
echo "enter URL"
read URL
echo "enter filename"
read NAME
w3m -dump "$URL" > "$NAME"
можно сохранить это как run_w3m.sh
, сделать это исполняемым файлом с chmod 755 run_w3m.sh
и выполнить его с ./run_w3m.sh
. Сценарий попросит URL и путь к файлу.