1

When I play some games with wine, I must not change the window, because of that, the game crash or that window are fill of black.

I'm using xfce4 desktop , when I press "PrintScreen" key from keyboard, this changes the window to "xfce4-screenshooter", and well I need take screenshots without ask me the filename I want to save it as.

I have installed "shutter", but I can use commands with the option "%NN" , because of that shutter show me an error or crash.

For example with:

shutter -f -e -n -o "$PWD/%NN_%d-%m-%Y-%T.png"

I want to make a simple script for save in somewhere with "Name_Number_Date" something like

#!/bin/bash

HERE=$($PWD)
FOLDER="$HOME/Images/Shutter"
let COUNTER=0
NUMBER=$(($COUNTER+1))

cd "$FOLDER"

for COUNTER in $NUMERO do
    NUMBER=$(($CONTADOR+1))
    shutter -f -e -n -o "$FOLDER/"$NUMBER"_%d-%m-%Y.png" &
done

Can someone help me with this?

1

Use file matching operator in your for loop. for f in *_*.png will match all the png file names as you specified and assign each name to variable f. Then inside the loop use the ${f%_*} bash operation to extract only the number of the file.

FOLDER="$HOME/Images/Shutter"
cd "$FOLDER"
for f in *_*.png
do
    num=${f%_*}
    shutter -f -e -n -o "${FOLDER}/${num}_$(date '+%d-%m-%Y.png')"
done
  • In the ${num} , how i can do "Incremetal Value" ???? – inukaze Dec 14 '14 at 23:21
  • increment like this: numplus=$((num+1)) – suspectus Dec 15 '14 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.