[Return] [Catalog]

1 guest@cc 2021-07-02T09:09:06 [ImgOps] [iqdb]
File: 8775867546454565857857.jpg (JPEG, 69.4KB, 525x393)
hello /cc/
Need some help on shell scripting. Could you help me how to make this code better?


#!/usr/bin/bash

DOING(){
duhhh=$(xclip -out)
xdotool mousemove 847 223 click 1 | sleep 0.1
xdotool mousemove 30 733 click 1 | sleep 0.1 | xdotool mousemove 30 733 click 1
xclip -t -selection "primary" -quiet -silent > /dev/null 2>&1
}

ADDITION(){
((duhhh++))
echo $duhhh
}


DOING
ADDITION


The thing about this script is, it doesn't work for the first run. Instead of echoing the real value, I got 1. But after do the second run, the value is correct as intended. "xclip" is a program equivalent to Ctrl+C and Ctrl+V where you can save selected line into clipboard for X11. If it tries to copy new value than before, same symptom happened. It always when running on the second time that works.
»
2 guest@cc 2021-07-04T01:11:18
>Instead of echoing the real value, I got 1
I'm guessing that duhhh is originally set to not an integer, try this in your shell

$ foo=aaaaaaaaaaaa
$ ((foo++))
$ echo ${foo}
1


Your code and use case is too specific for me actually test and fix your script.

[Return] [Catalog]
Delete Post:
OptionsPassword
Name
Comment
File