Skip to main content
added 28 characters in body
Source Link

I am currently learning French. To, and in order to streamline my study process, I wantwould like to have a script that I can useallows me to look-up up words on Wiktionary and keep a record of my look-upssearches for later review.

After some trial and error, I hacked together a bash script that launched the Wiktionary page for my text selection and saved the selection, and the date of the selection, to a text file.

#!/bin/bash

firefox 'https://en.wiktionary.org/wiki/'$(xsel)'#French'
echo $(xsel)$(date +": %Y-%m-%d (%a)") >> fr/word-list.txt

The first dozen times I used the script it worked as desired. However, for some reason, the second line of the script is no longer fully working. The date is still outputted to the file but not the xsel text selection. The first line below is expected output; the second line is an example of the output I am currently getting.

enterrement: 2023-06-18 (Sun)
: 2023-06-18 (Sun)

I'm sure my noob script could be improved but the problem seems to be with xsel itself as it is not working consistently when I run it by itself. Sometimes it is returning a blank output including when I use xsel -o, xsel -ob, and xsel -op.

Confusingly, the first line of the script, which also relies on xsel, is working consistently.

I am currently learning French. To streamline my study process I want a script that I can use to look-up words on Wiktionary and keep a record of my look-ups for later review.

After some trial and error, I hacked together a bash script that launched the Wiktionary page for my text selection and saved the selection, and the date of the selection, to a text file.

#!/bin/bash

firefox 'https://en.wiktionary.org/wiki/'$(xsel)'#French'
echo $(xsel)$(date +": %Y-%m-%d (%a)") >> fr/word-list.txt

The first dozen times I used the script it worked as desired. However, for some reason, the second line of the script is no longer fully working. The date is still outputted to the file but not the xsel text selection. The first line below is expected output; the second line is an example of the output I am currently getting.

enterrement: 2023-06-18 (Sun)
: 2023-06-18 (Sun)

I'm sure my noob script could be improved but the problem seems to be with xsel itself as it is not working consistently when I run it by itself. Sometimes it is returning a blank output including when I use xsel -o, xsel -ob, and xsel -op.

Confusingly, the first line of the script, which also relies on xsel, is working consistently.

I am currently learning French, and in order to streamline my study process, I would like to have a script that allows me to look up words on Wiktionary and keep a record of my searches for later review.

After some trial and error, I hacked together a bash script that launched the Wiktionary page for my text selection and saved the selection, and the date of the selection, to a text file.

#!/bin/bash

firefox 'https://en.wiktionary.org/wiki/'$(xsel)'#French'
echo $(xsel)$(date +": %Y-%m-%d (%a)") >> fr/word-list.txt

The first dozen times I used the script it worked as desired. However, for some reason, the second line of the script is no longer fully working. The date is still outputted to the file but not the xsel text selection. The first line below is expected output; the second line is an example of the output I am currently getting.

enterrement: 2023-06-18 (Sun)
: 2023-06-18 (Sun)

I'm sure my noob script could be improved but the problem seems to be with xsel itself as it is not working consistently when I run it by itself. Sometimes it is returning a blank output including when I use xsel -o, xsel -ob, and xsel -op.

Confusingly, the first line of the script, which also relies on xsel, is working consistently.

Source Link

xsel not outputing to file in bash script

I am currently learning French. To streamline my study process I want a script that I can use to look-up words on Wiktionary and keep a record of my look-ups for later review.

After some trial and error, I hacked together a bash script that launched the Wiktionary page for my text selection and saved the selection, and the date of the selection, to a text file.

#!/bin/bash

firefox 'https://en.wiktionary.org/wiki/'$(xsel)'#French'
echo $(xsel)$(date +": %Y-%m-%d (%a)") >> fr/word-list.txt

The first dozen times I used the script it worked as desired. However, for some reason, the second line of the script is no longer fully working. The date is still outputted to the file but not the xsel text selection. The first line below is expected output; the second line is an example of the output I am currently getting.

enterrement: 2023-06-18 (Sun)
: 2023-06-18 (Sun)

I'm sure my noob script could be improved but the problem seems to be with xsel itself as it is not working consistently when I run it by itself. Sometimes it is returning a blank output including when I use xsel -o, xsel -ob, and xsel -op.

Confusingly, the first line of the script, which also relies on xsel, is working consistently.