Awk returns different string from what appears to be the exact same?

Hey, this is more of a general awk issue. 
I'm running Arch on an x200 Thinkpad tablet and trying to improve on the rotate script in the wiki.
Currently, the wiki's script has predefined values for the stylus/eraser devices that don't work for all systems (mine for example).  I would like to make it so that these device names are discovered by the script at runtime so that the user doesn't have to edit the script to make it work.
In order to do this, I'm using
stylus="$(xsetwacom --list | grep STYLUS | awk '{$NF="\b"; print}')"
and likewise for the eraser.
The problem is that when the script runs, it says "Cannot find device 'Serial Wacom Tablet stylus'." even though that's the exact thing I had in the script before messing with the variable assignment. 
What makes these strings different? Is there some nuance of awk that I'm missing?

#!/bin/bash
#### rotate.sh - A script for tablet PCs to rotate the display.
## This software is licensed under the CC-GNU GPL.
## http://creativecommons.org/licenses/GPL/2.0/
## http://wiki.archlinux.org/index.php/Tablet_PC
## REQUIRES: linuxwacom (http://linuxwacom.sourceforge.net/)
#### Function(s)
function set_normal {
xsetwacom set "$stylus" Rotate 0
xsetwacom set "$eraser" Rotate 0
xrandr -o normal
function set_right {
xsetwacom set "$stylus" Rotate 1
xsetwacom set "$eraser" Rotate 1
xrandr -o right
function set_left {
xsetwacom set "$stylus" Rotate 2
xsetwacom set "$eraser" Rotate 2
xrandr -o left
function set_inverted {
xsetwacom set "$stylus" Rotate 3
xsetwacom set "$eraser" Rotate 3
xrandr -o inverted
#### Variable(s)
orientation="$(xrandr --query --verbose | grep connected | grep -v dis | awk '{print $5}')"
eraser="$(xsetwacom --list | grep ERASER | awk '{$NF="\b"; print $0}')"
stylus="$(xsetwacom --list | grep STYLUS | awk '{$NF="\b"; print $0}')"
#### Main
if [ "$orientation" = "normal" ]; then
set_right
elif [ "$orientation" = "right" ]; then
set_inverted
elif [ "$orientation" = "inverted" ]; then
set_left
elif [ "$orientation" = "left" ]; then
set_normal
fi
#### EOF
Like I said, a slight modification of the original wiki script. 
xsetwacom --list returns
Serial Wacom Tablet stylus STYLUS
Serial Wacom Tablet eraser ERASER
Edit:
I whipped up a short script to illustrate my problem
#! /bin/bash
therightthing="Serial Wacom Tablet stylus"
stylus="$(xsetwacom --list | grep STYLUS | awk '{$NF="\b"; print}')"
if [ "$therightthing" = "$stylus" ]; then
echo "Equal"
else
echo "Not Equal"
echo "$stylus |"
echo "$therightthing |"
fi
The vertical line is my check for trailing whitespace.  When run, it returns that they're not equal, but the strings look the exact same.
Output:
Not Equal
Serial Wacom Tablet stylus |
Serial Wacom Tablet stylus |
Last edited by Pursuit (2010-09-27 23:05:39)

Similar Messages

  • (get-spfarm).buildversion is returning different version from what I currently have

    I have SharePoint 2013 server installed inside windows serve 2008 r2. And I have install all the SharePoint updates using windows update (except October 2014 CU), and the final CU should include both SP1 and September 2014 CU.also i run the configuration
    wizard and it worked succcfully.
    However currently if I run the following command
    (get-spfarm).buildversion
    I will get
    PS C:\Windows\system32> (get-spfarm).buildversion
    Major Minor Build Revision
    15 0 4641 1000
    But on the following link
    http://blogs.technet.com/b/steve_chen/archive/2013/03/26/3561010.aspx it mentioned that 4641 is related to august 2014 CU 
    and not September 2014. So can anyone advice please?
    One simple note to consider is that September 2014 contained a fix regarding wiki pages, and I have this fix implemented on my current wiki site,, which I assume that I have September 2014 cu correctly installed… can anyone advice please ?

    Firstly: Don't install CUs automatically. It isn't a universal opinion but the majority of the community advocates only installing CUs if they fix something you know is causing problems on your farm.
    If you really want to install the CU, download it manually and install it manually. It will either tell you it's already installed and abort or install itself.
    A more scientific approach would be to check your 'Manage Patch Status' page and search for the latest build number. That should be visible on there if you've installed the patch, although it should NOT be the only value there.
    >>Firstly: Don't install CUs automatically. It isn't a universal opinion but the majority of the community advocates >>only installing CUs if they fix something you know is causing problems on your
    farm.
    i think this is not aligned with Microsoft recommendations, to always install the latest CU as it can have improvement for security and performance and not just bug fixes!!
    >>If you really want to install the CU, download it manually and install it manually. It will either tell you it's already >>installed and abort or install itself.
    Also on MSDN it is mentioned that the recommended approach to install CU for SharePoint is using windows update tool.... and not manully install them
    >>A more scientific approach would be to check your 'Manage Patch Status' page and search for the latest build >>number. That should be visible on there if you've installed the patch, although it
    should NOT be the only value >>there.
    As i mentioned before, i have 4649 installed as per the "Patch status"inside the Central Administrator, but my get-spfarm.buildversion is saying that i got 4641. so the patch for september 2014 is installed using WU , but this is not reflected
    inside the get-spfarm.buildversion ?? so i have the feeling that this is a bug in sharepoint , it is giving different build numbers ..
    Can u advice ?

  • Returning XML String From Servlet

              Is there a simple way to disable the HTML character escaping when returning
              a string from a servlet. The returned string contains well formed XML, and
              I don't want the tags converted to > and < meta characters in the
              HTTP reply.
              The code is basically "hello world", version 7.0 SP2.
              Thanks
              > package xxx.servlet;
              >
              > import weblogic.jws.control.JwsContext;
              >
              >
              > /**
              > * @jws:protocol http-xml="true" form-get="false" form-post="false"
              > */
              > public class HelloWorld
              > {
              > /** @jws:context */
              > JwsContext context;
              >
              > /**
              > * @jws:operation
              > * @jws:protocol http-xml="false" form-post="true" form-get="false" soap-s
              tyle="document"
              > * @jws:return-xml xml-map::
              > * <HelloWorldResponse xmlns="http://www.xxx.com/">
              > * {return}
              > * </HelloWorldResponse>
              >
              > * ::
              > * @jws:parameter-xml xml-map::
              > * <HelloWorld xmlns="http://www.xxx.com/">
              > * <ix>{ix}</ix>
              > * <contents>{contents}</contents>
              > * </HelloWorld>
              >
              > * ::
              > */
              > public String HelloWorld(String s)
              > {
              > return "<a> xyz </a>";
              > }
              > }
              

              Radha,
              We have a client/server package which speaks SOAP over a
              streaming HTTP channel for which we are writing a WebLogic
              servlet. For reasons of efficiency, we want to deserialize
              only the very top-level tags of the messages as they pass
              through the servlet. Yes, in theory, we should probably
              deserialize and validate the entire message contents...
              When we add support for other clients, we will fully
              deserialize inside those servlets.
              I have not looked any further into how to stop the inner
              tags from being escaped yet -- it is an annoyance more than
              a disaster, since the client handle meta escapes.
              My current guess is to use ECMAScript mapping...
              -Tony
              "S.Radha" <[email protected]> wrote:
              >
              >"Tony Hawkins" <[email protected]> wrote:
              >>
              >>Is there a simple way to disable the HTML character escaping when returning
              >>a string from a servlet. The returned string contains well formed XML,
              >>and
              >>I don't want the tags converted to > and < meta characters in the
              >>HTTP reply.
              >>
              >>The code is basically "hello world", version 7.0 SP2.
              >
              >>
              >>Thanks
              >>
              >>> package xxx.servlet;
              >>>
              >>> import weblogic.jws.control.JwsContext;
              >>>
              >>>
              >>> /**
              >>> * @jws:protocol http-xml="true" form-get="false" form-post="false"
              >>> */
              >>> public class HelloWorld
              >>> {
              >>> /** @jws:context */
              >>> JwsContext context;
              >>>
              >>> /**
              >>> * @jws:operation
              >>> * @jws:protocol http-xml="false" form-post="true" form-get="false"
              >>soap-s
              >>tyle="document"
              >>> * @jws:return-xml xml-map::
              >>> * <HelloWorldResponse xmlns="http://www.xxx.com/">
              >>> * {return}
              >>> * </HelloWorldResponse>
              >>>
              >>> * ::
              >>> * @jws:parameter-xml xml-map::
              >>> * <HelloWorld xmlns="http://www.xxx.com/">
              >>> * <ix>{ix}</ix>
              >>> * <contents>{contents}</contents>
              >>> * </HelloWorld>
              >>>
              >>> * ::
              >>> */
              >>> public String HelloWorld(String s)
              >>> {
              >>> return "<a> xyz </a>";
              >>> }
              >>> }
              >>
              >>
              >Hi Tony,
              >
              > Can you let me know for what purpose you want to disable the
              >HTML character
              >escaping.In case if you
              >
              >have tried this using someway,pl. let me know.
              >
              >rgds
              >Radha
              >
              >
              

  • Return a string from a method: a problem in C++ but is it a problem in java

    I have a method which return a String from it as:
    String pattern(short i)
    String s="":
    if (i==1)
    s = "test1";
    else
    s = "test2";
    return s;
    Since s is a local vaariable to pattern(), does the code above
    create problems? I know it is a problem for C++ since the local
    variable memory address will be reused by others and thus the
    returned value may take other values sometime later or not
    readable.

    Actually, this is not a problem in C++ either if you
    just use the string class instead of the old-style
    char* from C.True, I was assuming he/she meant (in C++):
    char mylocalbuf[80];
    // put stuff in mylocalbuf here
    return mylocalbuf;
    which would be very very bad to do indeed.

  • When i play an album the first one plays but a different track from itunes plays instaed of the one on album.upto date on version

    when i play an album the first one plays but a different track from itunes plays instead not the one on album.

    Sorry guys, I had the shuffle on. Doh..

  • I have copied my music library from two different files from extewrnal hard drive into the Itunes folder. I tunes only recognizes some of the songs. I have reloaded 5 times and can't get intunes to recognize all my songs? HELP!

    I have copied my music library from two different files from extewrnal hard drive into the Itunes folder. I tunes only recognizes some of the songs. I have reloaded 5 times and can't get intunes to recognize all my songs? HELP!

    " When I did this, my library showed all the music I have "purchased" from itunes but did not have the music that I downloaded a long time ago through itunes from my old CDs."
    Correct.
    " How can I get that music to show up in my library now on my new computer?  "
    Copy it from your old computer or your backup copy of your old computer.
    The sync is one way - computer to ipod.

  • Can I create a custom XMP panel but using the exact same fields from standard XMP panels?

    Hi,
    I am new to XMP and not very technical, so please excuse me if this sounds like a stupid question!
    I have managed to create my own custom panels for Photoshop using the Generic Panel method with my own custom fields and they work fine. However what I need to do now is create a custom panel that uses the exact same fields from some of the standard panels. The reason being is that I have 4 fields that need to be integrated into another non-adobe system (Extensis Portfolio) that recognizes standard XMP fields, but at present these 4 fields are spread across different standard panels and it would be much easier for the user in Photoshop if they were all together on one panel.
    An example field is the "Additional Model Info" field that currently resides on the standard IPTC Extension panel. If I fill in a value in this field on a JPEG then open the the image in Extensis Portfolio, then the field is also filled in in a field called IPTC - Model Info, displaying a key of Iptc4xmpExt:AddlModelInfo.
    Is there a way I can take this standard field and use it on a custom panel, so that it can still be filled in in Photoshop and the value viewed in Extensis Portfolio? Sure I can create a custom panel and create a field called "Additional Model Info" but I can't figure out how to connect it to the corresponding field in Portfolio. I tried changing the  xmp_property name="Iptc4xmpExt:AddlModelInfo" but this just broke the panel.
    Is what I am trying to do possible and if so how and can it be done using the Generic Panel method?
    Many thanks!

    I am trying to do the same thing but with only the IPTC Keywords field. Searching everywhere but no luck.
    Thanks!

  • I updated to Muse CC (2014.2) recently, but this morning it appeared in my Creative Cloud menu as needing to be updated again. Is that a minor upgrade with the exact same name?

    I updated to Muse CC (2014.2) recently, but this morning it appeared in my Creative Cloud menu as needing to be updated again. Is that a minor upgrade with the exact same name?

    The update is for few bug fixes and will show 2014.2 in CC as the update includes hotfix : Release notes | Adobe Muse CC
    For exact version details you can check about muse from Muse menu options.
    Thanks,
    Sanjit

  • While my friend was setting up his iphone, i used my icloud. So now, when i send him a message i get the exact same message from myself. How do i fix this?

    While my friend was setting up his iphone because i had recently updated it for him he needed a itunes account to use for "bump" so i could transfer his contacts back. So i used my itunes and icloud account to sign in so he could download that because he didnt have any of those accounts. So when i logged in he was basically me, my name was his phones name aswell. Well i used "bump" his name was the same as mine. I got the contacts to work but now every time i send him a text message, (imessage) i get the exact same message from myself. How to i unverify him off of my icloud so i can be the only one using it?

    The fact that the problem only occurs when iphones are texting you leads me to think that iMessage may be the culprit. The fact that it is only iphones using SPRINT however is weird. Try turning imessage off on both yours and your sons phones to see if the problem persists. If it does, it may be a carrier problem.

  • I have got the canon 550d, and when i try to import those photos to iPhoto, it imports two photos of the exact same photo, what should i do

    I have got the canon 550d, and when i try to import those photos to iPhoto, it imports two photos of the exact same photo, what should i do

    Check the settings on your camera to make sure you're not shooting Raw and Jpeg pairs or shooting bursts.
    Regards
    TD

  • Ok, so I want to buy the new iPod touch 5g this week and I have an iPhone 4. I want to transfer all the data from the phone to the iPod and have the files the exact same. I don't want to redo data, say erase game data (campaigns, achievements)...

    Ok, so I want to buy the new iPod touch 5g this week and I have an iPhone 4. I want to transfer all the data from the iPhone to the iPod and have the files the exact same. I don't want to redo data, say erase game data (campaigns, achievements)... I have apps that have very important data on them and if I sync it to iTunes and then transfer all that data to the iPod Touch 5g, will that erase app data?

    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device

  • Why are emails downloaded with the subject and from address different from what is actually in the email?

    The subject and from address listed in the message pane are totally different from what is in the actual email, viewed either in the preview pane or when the email is opened. The emails are correct when viewed online. For example:
    Email subject A from Sender A - email A
    Email subject B from Sender B - email B
    Email subject C from Sender C - email C
    After downloading to Thunderbird:
    Email subject A from Sender A - email A
    Email subject B from Sender B - email B
    Email subject C from Sender C - email A *** Subject and Sender for C but is actually email A
    This started happening within the past month and appears to be random. Sometimes everything is correct. But more often there are a few that exhibit the above behavior. I have multiple email address downloading from the same domain but this problem seems to occur ostly with my main email account.

    Try to rebuild the index file of the troubled folder.
    Right-click the folder - Properties - Repair Folder

  • Adobe Media Encoder exports different video than what appears in CS4 timeline

    I'm using Premiere CS4 to edit a short skiing video.  All shots were taken using a GoPro @ 60fps, 720p.  All of the clips were converted into slow motion by using "Interpret Footage" and setting the frame rate to 24.  I used the sequence preset "AVCHD 720p 24", and editing seemed to work fine.  The video played smoothly and correctly.  However, after exporting in Adobe media encoder, the video was far different than what I previewed in the timeline.  It seems as though each clip shows up at the correct time, but it disregarded any trimming I did to the clips and each one is played from the very beginning.  Also, each clip plays extremely slowly, and there is signifigant ghosting (frame blending issue?).  I can also see that the preview window that shows up while I set the export settings displays the incorrect video as well.  However, if i change it from "source" to "output", it displays it correctly.  I tried exporting using H.264 720 24p and the youtube HD widescreen preset, both of which failed.  I am somewhat new to HD video, but I cannot seem to come up with any reason why my video will not export correctly.  Any thoughts?
    PC Specs:
    Intel Q6700 quad core @ 2.66gh
    4gb ddr2 ram
    1tb 7200rmp hard drive
    GeForce gt240 graphics card w/ 1gb dedicated video mem
    windows 7 ultimate 64
    All updates to premiere installed

    I don't think AVCHD is the correct preset... but I use CS5 so not 100% sure
    Flip or GoPro video http://forums.adobe.com/thread/437535?tstart=0
    - And http://forums.adobe.com/thread/668369?tstart=0
    - And http://blogs.adobe.com/VideoRoad/2009/12/using_a_flip_minohd_camera_wit.html
    - Says to use the XDCAM EX 720p 30p (or 60p?) setting for Flip (maybe GoPro?)

  • Queue returns blank strings from template VI

    I have created a master VI which creates a named queue, this VI then spawns multiple copies of a template VI. These sub VIs all gain access to the queue and try writing data to it. I understood that the queue VI was protected so this should not cause a problem. Infact this does not work at all, when i extract element within the master VI it only finds a few of the elements and returns blank strings between. Help what is going on. I am not destroying the queue or such, it seems to be a problem with the protection of the queue when using template VIs.
    Cheers Tom.

    I have not been able to reproduce the problem on LV 6.0.2 Win98. Do you check the error cluster when an empty element is returned? Posting your code might help to find the problem.
    LabVIEW, C'est LabVIEW

  • Select statement returns different results from 9i and 10g

    Hi all,
    Would appreciate if someone could help to solve this puzzle here:
    I have the exact the statements running on Oracle 9i and 10g, why do they return different results?
    Select unique(GroupDesc) , GroupSeq from Module where ModuleId in (Select ModuleId from User_Access where UserId='admin') and Status='A'
    In Oracle 9i:
    Both columns returned as follows...
    GroupDesc | GroupSeq
    In Oracle 10g:
    Only one column returned, the column with unique keyword was missing...
    GroupSeq
    Could anyone enlighten me?

    yes, the table structure... actually the CREATE TABLE statement...
    with some sample data (INSERT INTO)
    and the actual queries (both of them - copy-paste them from each separate environment)
    you can use tags around the statements this will format it to a fixed font - making it easier to read
    Edited by: Alex Nuijten on Feb 20, 2009 10:05 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Few questions regarding Training and event management

    Dear All, Can you please help me with the following queries regarding Training and Event Management: 1. How to freeze a completed business event so that no changes to its record (like delete/update attendee details or event detail) is possible? 2. Ho

  • Rendering in Final Cut Pro 10.1.2 is incredibly slow

    I just Upgraded to Final Cut Pro 10.1.2 and rendering has become incredibly slow. I am using OSX 10.9.4 on an IMAC with 32GB of RAM on a 3.4GHz machine. In previous version I had absolutley NO trouble. Since my Libraries were upgraded by this version

  • RFC (Sync) - File (async) always via s/a Bridge?

    Hi, maybe a silly question, but do I always have to use the s/a Bridge when I have a sync. RFC sender and a async receiver? Is there another possibility without bpm (well using a async RFC of course)? Thank you Thomas

  • Why do email recipients receive "Part 1.2.3" attachments?

    Every email sent using Mail that has attachments also includes an extra file, named "Part 1.2.3" or something. Anyone NOT using Mail as an email client gets these files. The file contents are something like "<html><body style="word-wrap: break-word;

  • Add a pin to bitlocker startup

    hi all, I updated my T500 to use Bitlocker with the TPM. Now, to further secure it against brute force password attacks, I want to add a PIN to the startup.  I see that gpedit.msc option to Require additional authentication at startup but I am not su