abarbarian Posted March 8, 2012 Share Posted March 8, 2012 (edited) Hi I had a read at Arch Alias wiki and made a few alias's and placed them in ~/.bashrc. These work just fine alias yup="yaourt -Syua" alias s5="scrot -d 5 ~/Mirages/screenshots/%Y-%m-%d-%T-screenshot.jpg" alias s10="scrot -d 10 ~/Mirages/screenshots/%Y-%m-%d-%T-screenshot.jpg" These do not work and I guess it is because they are complicated commands and I have missed something out.The commands do work if used in xterm but not when I try to make them an alias. alias pcr100="mogrify -path PCR100 -thumbnail 100x100!" *.png alias scots128="mogrify -path Scots128 -thumbnail 128x128!" *.png Edited March 8, 2012 by abarbarian Quote Link to comment Share on other sites More sharing options...
securitybreach Posted March 8, 2012 Share Posted March 8, 2012 You forgot the closing quotes on your last two alias'. The closing quotes need to be at the end of the commands and not in the middle of them. Quote Link to comment Share on other sites More sharing options...
securitybreach Posted March 8, 2012 Share Posted March 8, 2012 You should make these changes: alias pcr100="mogrify -path PCR100 -thumbnail 100x100!" *.png alias scots128="mogrify -path Scots128 -thumbnail 128x128!" *.png to alias pcr100="mogrify -path PCR100 -thumbnail 100x100! *.png" alias scots128="mogrify -path Scots128 -thumbnail 128x128! *.png" Quote Link to comment Share on other sites More sharing options...
abarbarian Posted March 8, 2012 Author Share Posted March 8, 2012 Thanks :"> I could have sworn I tried that variation. This works for me and puts the screenshot into "~/Mirages/capture" from exterm(eg.2012-03-08_572x624.png) scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/Mirages/capture/' If I use "sc" in exterm this alias I have made puts a picture in "~/" (eg.2012-03-08_.png) alias sc="scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/Mirages/capture/'" and tells me this mv: missing destination file operand after `/home/bloodaxe/Mirages/capture/' Try `mv --help' for more information. :"> I guess I have missed or put something in the wrong place again Quote Link to comment Share on other sites More sharing options...
V.T. Eric Layton Posted March 8, 2012 Share Posted March 8, 2012 Google doesn't want you to use aliases. You MUST use the real command names when using Google. Quote Link to comment Share on other sites More sharing options...
securitybreach Posted March 8, 2012 Share Posted March 8, 2012 This may be because the $f variable is not working since you would normally get the mv error if you forget the destination folder in the command EX: mv source /destination Try changing: alias sc="scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/Mirages/capture/'" to: alias sc="scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv *.png ~/Mirages/capture/'" Quote Link to comment Share on other sites More sharing options...
abarbarian Posted March 8, 2012 Author Share Posted March 8, 2012 alias sc="scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv *.png ~/Mirages/capture/'" alias sc="scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv ~/*.png ~/Mirages/capture/'" Nope my variation did not either. Could it be to do with('") the single and double quote marcks at the end? The $f works with scrot so I can not see why it is different as an alias :"> Quote Link to comment Share on other sites More sharing options...
securitybreach Posted March 8, 2012 Share Posted March 8, 2012 Nope my variation did not either. Could it be to do with('") the single and double quote marcks at the end? The $f works with scrot so I can not see why it is different as an alias :" border="0" alt="blushing.gif" /> Oh wait aliases are supposed to have single quotes instead of double quotes around the command: alias rb='dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Reboot' alias ya='packer -Syu' Quote Link to comment Share on other sites More sharing options...
abarbarian Posted March 8, 2012 Author Share Posted March 8, 2012 Single qoutes don't work either. alias sc='scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/Mirages/capture/'' Xterm gives this if I try the above bash: alias: /home/bloodaxe/Mirages/capture/: not found [bloodaxe@longship ~]$ sc mv: missing file operand Try `mv --help' for more information. . An the Arch wiki shows double quotes, # pacman aliases (if applicable, replace 'pacman' with 'yaourt'/'pacaur'/whatever) alias pac="pacman -S" # default action - install one or more packages alias pacu="pacman -Syu" # 'pdate' - upgrade all packages to their newest version alias pacs="pacman -Ss" # 'earch' - search for a package using one or more keywords Quote Link to comment Share on other sites More sharing options...
securitybreach Posted March 8, 2012 Share Posted March 8, 2012 bash: alias: /home/bloodaxe/Mirages/capture/: not found Well there you go, the file is not located in the directory you specified. Check the folder contents again and make sure they match the filename. Quote Link to comment Share on other sites More sharing options...
abarbarian Posted March 8, 2012 Author Share Posted March 8, 2012 Well there you go, the file is not located in the directory you specified. Check the folder contents again and make sure they match the filename. Thanks for the help. Seems like but it does not seem as though I am able to do as I would like. My expalnation is probably unclear. This works for me and puts the screenshot into "~/Mirages/capture" from exterm (eg.2012-03-08_572x624.png) scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/Mirages/capture/' If I use "sc" in exterm this alias I have made puts a picture in "~/" (eg.2012-03-08_.png) alias sc="scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/Mirages/capture/'" ~/Mirages/capture/ is an empty directory. If I use scrot from exterm as above it puts a file into ~/Mirages/capture/ as the eg: shows. If I make an alias "sc" and then run "sc" a picture is put in ~/ and the file looks like the eg: Thanks again for your time. Quote Link to comment Share on other sites More sharing options...
securitybreach Posted March 9, 2012 Share Posted March 9, 2012 I tried messing with the syntax and in the end, it seemed that bashrc reads thing in single quotes as the command whereas you needed scrot to read the single quotes. It works fine by itself but not as an alias. Scrot always outputs unique filenames (date|number|resolution) and in png format: EX: 2012-03-08-213720_5120x1080_scrot.png (5120x1080 being my screen resolution) So try this command instead: scrot && mv 2012*.png Mirage/capture/ ╔═ comhack@Cerberus 10:07 PM ╚═══ ~-> scrot && mv 2012*.png Mirage/capture/ ╔═ comhack@Cerberus 10:07 PM ╚═══ ~-> ls Mirage/capture/ 2012-03-08-220720_5120x1080_scrot.png The reason I used 2012* is so that it would not move all .png files to that directory. It also works great as an alias as well: ╔═ comhack@Cerberus 10:08 PM ╚═══ ~-> cat .bashrc | grep sc alias sc='scrot && mv 2012*.png Mirage/capture/' ╔═ comhack@Cerberus 10:09 PM ╚═══ ~-> sc ╔═ comhack@Cerberus 10:09 PM ╚═══ ~-> ls Mirage/capture/ 2012-03-08-220720_5120x1080_scrot.png 2012-03-08-220902_5120x1080_scrot.png As you can see it works beautifully. Time to remove the Mirage directory and the alias. Quote Link to comment Share on other sites More sharing options...
abarbarian Posted March 9, 2012 Author Share Posted March 9, 2012 Once again thanks for your time and efforts. don't know what os you are trying this on but on my basic Arch it does not work as your example. Trying your first command gets me $ scrot && mv 2012*.png Mirage/capture/ mv: cannot move `2012-03-09-104208_1920x1200_scrot.png' to `Mirage/capture/': No such file or directory [code] This placed a file `2012-03-09-104208_1920x1200_scrot.png' in my "home" directory and then every time i tried to run the command I got [code]$ ]$ scrot && mv 2012*.png Mirage/capture/ bash: ]$: command not found [bloodaxe@longship ~]$ mv: cannot move `2012-03-09-104208_1920x1200_scrot.png' to `Mirage/capture/': No such file or directory > So I tried your suggestion as an alias and get [bloodaxe@longship ~]$ sc mv: cannot move `2012-03-09-105751_1920x1200_scrot.png' to `Mirage/capture/': No such file or directory [bloodaxe@longship ~]$ sc mv: target `Mirage/capture/' is not a directory [bloodaxe@longship ~]$ sc It does however put files in the "home" directory like so 2012-03-09-110311_1920x1200_scrot.png 2012-03-09-110319_1920x1200_scrot.png Your code is for taking full screenshots and placing the file into a specific folder and can be used as an alias. however my opening post shows that I have already worked out how to do this. I think that the reason a lot of the above did not work is that I have "Mirages" and not "Mirage" so my copying and pasting was no good and as it is not relevant to my problem I ain't trying it all again. My problem is how to create an alias using the "-s" feature in scrot and place the file into a specific folder. See post 4. In exterm if I type in scrot -s '%Y-%m-%d_$wx$h.png' -e 'mv $f ~/Mirages/capture/' I get a series of files in ~/Mirages/capture/ but it is a pain to have to type in that command or copy and paste it from a file. So I am looking for a alternative. After trying all sorts of permutations at making a alias I found that alias sc='scrot -s && ~/Mirages/capture/.png' Would place files in "~/" and not overwrite them like so 2012-03-09-122030_255x442_scrot.png 2012-03-09-122550_179x502_scrot.png So some of your code magic is working Mind you this does the same alias sc='scrot -s && mv ~/Mirages/capture/' alias sc='scrot -s && mv ~/Mirages/capture/*.png' alias sc='scrot -s ~/Mirages/capture/.png' with this message in xterm $ sc bash: /home/bloodaxe/Mirages/capture/%Y-%m-%d-%T.png: No such file or directory Well I tried all sorts of permutations and kept getting similar results. Eventually I could get a file to apperar in ~/Mirages/capture/ but it would appear as " *.png" and get overwritten no matter what I did. So finally I tried alias sc='scrot -s && mv 2012*.png ~/Mirages/capture/' An blow me down with a feather it worked. Now if only I had spotted the missing "s" sooner and simply tried to put in "-s" I would have had a result much sooner. :hysterical: Many thanks for the help Quote Link to comment Share on other sites More sharing options...
securitybreach Posted March 9, 2012 Share Posted March 9, 2012 The -s switch is for selecting the window to take a screenshot of a window, why would use that instead of just scrot? I use the -s switch if I have a specific window I want to take a screenshot of. otherwise it is just one more step to get a screenshot: -s, --select interactively choose a window or rectangle with the mouse The -s should not be required at all to take a simple screenshot of everything on the screen. Quote Link to comment Share on other sites More sharing options...
abarbarian Posted March 9, 2012 Author Share Posted March 9, 2012 I probably should have explained a bit better in the begining but I thought what I was after was self explanetry. I managed to set up scrot and alias's for taking full desktop screenshots with delays which can be a useful feature. As I quite often need/want to take screenshots of part of a window or web page I wanted to set up scrot to work from an alias with the -s argument.Setting up scrot to do this is much easier than taking a full desktop/window shot and then cropping. Idealy I would like to have an alias that allowed me to interactivley take a screenshot after a delay. This would be useful for shots that need pop up menues to appear or disapperar before the shot is taken. Anyways your "&& mv 2012*.png" piece of code provided the solution so thanks again. Quote Link to comment Share on other sites More sharing options...
securitybreach Posted March 9, 2012 Share Posted March 9, 2012 Well the delay part is simple using the -d switch: ╔═ comhack@Cerberus 01:40 PM ╚═══ ~-> scrot -cd 5 Taking shot in 5.. 4.. 3.. 2.. 1.. 0. The -c part provides the countdown and can be used or not. Quote Link to comment Share on other sites More sharing options...
abarbarian Posted March 9, 2012 Author Share Posted March 9, 2012 Yeah I already got the delay part sussed not woth the countdown feature though.Your bit of code there helped a lot though as I have been trying scrot -d 5 -s && mv 2012*.png Mirage/capture/ scrot -s -d 5 && mv 2012*.png Mirage/capture/ Which did not work but alias scd='scrot -sd 10 && mv 2012*.png ~/Mirages/capture/' Works So finally with all the help I have alias s5="scrot -d 5 ~/Mirages/screenshots/%Y-%m-%d-%T.jpg" alias s10="scrot -d 10 ~/Mirages/screenshots/%Y-%m-%d-%T.jpg" alias sc='scrot -s && mv 2012*.png ~/Mirages/capture/' alias scd='scrot -sd 10 && mv 2012*.png ~/Mirages/capture/' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.