Meaning of x in find command e.g. if [ x$var = x"" ]

Could someone enlighten me as to the meaning of the x in something like this 'if [ x$var = x"" ]'
Cheers

It's an idiom for defensive scripting; it ensures that test's arguments are
unambiguous and the variables are not treated as operators. It also serves
as a visual clue to make the code easier to read.

Similar Messages

  • A Unix question: find command

    Hi all,
    Sorry for posting a Unix question here.
    In the following directory I have:
    /opt/SonicSoftware/SonicMQ/samples/TopicPubSub/DurableChat>ls
    DurableChat.class DurableChat.java Readme.txt
    However, if I try:
    /opt/SonicSoftware>find -iname DurableChat.class
    The path can not be found, it just gives me the prompt back; I don't know what the reason is. Any idea?

    I'm just wondering can the symbolic link be the
    reason that class file can not be found (I guess, not
    though, b/c other classes can be found):What do you mean "not found"?
    Do you mean why the find command isn't finding it? Yes, that's why. But now that you know, you can use -follow.
    Or do you mean the VM is unable to find the class at runtime? I'm almost certain the classloader can follow symbolic links in the classpath, so I don't think that's the problem.
    >
    /opt/SonicSoftware/SonicMQ/samples/TopicPubSub/Chat>..
    /../SonicMQ.sh DurableChat -u AlwaysUp
    Exception in thread "main"
    java.lang.NoClassDefFoundError: DurableChat
    Should I change the path that it won't be symbolic
    anymore?Try it and see if it fixes it. I'd be surprised, but you never know. If making it not a link fixes it, then maybe that's what you have to do. If it doesn't fix it, then you know you have to look somewhere else.

  • Can i get access to the find command in Word via activeX?

    Does anyone know if it is possible to search through a word document using activeX commands from labview? Basically i need to use the "find" command from Word.
    Thanks for your help

    Excellent thanks a lot.
    I've now got the search function working but im having a little trouble getting the results i want. What do you mean by "new selection"? is this the output refnum from the execute node?
    Im looking to search through a word document for a certain paragraph number then highlight this paragraph in some way.
    At present i have used your method to find the section number and then used a frame property on the output refnum followed by select method cascaded from this. This has the effect of selecting the number causing the word window to jump to the desired point but only the first line of the paragraph is shown because it places the found text at the bottom of the screen.
    Do you have any suggestions as to how i could select the en
    tire paragraph? I also cannot get any output from the select method in this way, am i using it incorrectly?
    Thanks again for your time
    Alan

  • Self-created invisible system file not found via Finder's Find command

    I need to see what is being created on my hard disk. To achieve that, I create a test file, call it .new in TextEdit, remove the hidden .rtf extension, and place it in one of the folders in /Library/Application Support. Then, I use Finders Find command, and ask to search This Mac, Created date: today, System files are included, File visibility Visible or Invisible, leaving the input field (for file contents or name) blank. The newly created file isn't found. I type its name into the input field, with the same result. I change its name to .new.plist . Same result. Suspecting that "System files" acutally means system files and doesn't include the Library on the top level, I place that same item in /System/Library/PodcastProducer. Same result.
    Seriously, this is entirely incomprehensible. The Find command obviously doesn't do what it says it does. Could anyone tell me how to get it to, or name some alternative?
    Thanks a lot.

    Actually you CAN get ressults for .whatever files and folders. I created a saved search for my home folder with the criterion of "File visibility::Invisible Items" and then "None of the following are true::Name contains" DS_Store, Icon or localized. The result is a list of 65 invisible items including things such as the files /Users/francine/Library/Preferences/ByHost/.GlobalPreferences.0017f20dca84.plis t (a dot file), /Users/francine/Library/Preferences/com.freeverse.5012 (something with the invisible flag set), the dot folder /Users/francine/.fontconfig, and many others of all of these types. I thought it was interesting that lots of them were inside the ~/Library folder, even though I did NOT specify including system files.
    I don't know why the original poster can't get Spotlight, using the the Command-f method, to display dot files. When I was setting my own invisible items search up I did manage to crash the Finder once, so it may be that the query for invisible items is buggy. Here's the Raw Query:
    (true) && (((kMDItemFSInvisible = 1) && (!((kMDItemDisplayName = "\DS_Store"cd) || (kMDItemDisplayName = "\Icon"cd) || (kMDItemDisplayName = "\localized"cd)))))
    If you go to a folder, do Command-f, then change from the default "Kind" to "Raw Query" and paste the above in as the query, you ought to get all the invisible files and folders, except the .DS_Store, Icon and localized files (of which there are likely hundreds of 'em in your home folder).
    Francine
    Francine
    Schwieder

  • Find command doesn't find embedded string, only initial string

    iMac 5K, Yosemite
    In Safari and Preview, I note a change from earlier versions. When I use the cmd-F Find command to search the contents of a page or document, it finds only cases where the search string is at the beginning of a word, not when it is in the middle. This can be really a problem for some kinds of searches, for example when you know the root word but can't anticipate all of the prefixes that could be used in the document.
    Silly example: search for "fringe" does not find the word "infringement".
    This is really disconcerting, especially as it marks a big invisible change over how string searching has worked since time immemorial (try searching for "memorial". Hah.)
    I don't see any preference that would let me specify what kind of searching I want to do. There needs to be at least a preference. Or a big warning that says, oh by the way, just because you didn't find it, doesn't mean it isn't there.

    Did you read my hint at http://www.macosxhints.com/article.php?story=20080229204517495 ?

  • Find command in terminal -- lists files twice

    I noticed the other day that after i used the find command to search for some files, the computer listed them twice -- first with just the names of the files (meaning ./(then the individual file names), then with the directory name, followed by the file names (directory name/file name). I was already in the desired directory, and I don't think this has ever happened before. Can someone tell me why it does this and how to fix it? Is there something wrong?
    Here's the command I'm using:
    find . -iname "*(text to search for)*" -type f
    and, if I use find from my home directory (that is, not in the desired subdirectory), it lists ./(subdirectory name)/(subdirectory name)/file names. This is really wierd. Is it supposed to do this?
    In case it matters, I also had to reinstall Snow Leopard the other day. I also just shut down the computer and restarted it, but that didn't change anything. Please help!

    Never mind --
    I feel like such an idiot. I didn't notice that I had put a copy of the directory from my flash drive into the subdirectory -- making it a subdirectory of the subdirectory
    DOH!

  • Find command in terminal - listing files twice

    I noticed the other day that after i used the find command to search for some files, the computer listed them twice -- first with just the names of the files (meaning ./(then the individual file names), then with the directory name, followed by the file names (directory name/file name). I was already in the desired directory, and I don't think this has ever happened before. Can someone tell me why it does this and how to fix it? Is there something wrong?
    Here's the command I'm using:
    find . -iname "*(text to search for)*" -type f
    and, if I'm in the home folder and not in the desired subdirectory, it lists ./(directory name)/(directory name)/file names. This is really wierd. Is it supposed to do this?

    HI,
    If you don't get any responses here, try posting in the Mac OS X Technologies Forum here.
    http://discussions.apple.com/forum.jspa?forumID=735
    Carolyn

  • Find Command in iCal doesn't work

    I have tried to use the Find Command in iCal. It doesn't work either from the Edit pull down command nor the keyboard command. Please try this in your setup and tell me whether it works?
    I have an Intel Mac Mini running 10.4.9.
    Bob Gallant

    Hi Bob,
    It works for me.
    Find will only search in selected calendars. Do you have the relevant calendars checked in the calendar list? (you can select all calendars by Command-Clicking one checkbox)
    Best wishes
    John M

  • Help please! [using Runtime.exec() to run find command in UNIX]

    Hi guys! im trying to use exec() to run the UNIX find command
    that my application uses. As you can see from my sample code, the find command finds all files ending with html in my home directory. Unfortunately when I run the program it doesn't give me an output, but when I run it on the shell in the same directory as this code is saved, it works perfectly fine.
    Could someone please help me on this one. Many thanks! =)
    import java.io.*;
    import java.lang.String;
    public class RunCommand {
            public static void main(String[] args) {
                    try {
                            String[] command = {"find", "~/", "-name",
                                            "*.html", "-print"};
                            String find_str;
                            Process find_proc = Runtime.getRuntime().exec(
                                            command);
                            DataInputStream find_in = new DataInputStream(
                                            find_proc.getInputStream());
                            try {
                                    while ((find_str = find_in.readLine())
                                                                    != null) {
                                            System.out.println(find_str);
                            } catch (IOException e) {
                                    System.exit(0);
                    } catch (IOException e1) {
                            System.err.println(e1);
                            System.exit(1);
                    System.exit(0);
    }

    I don't see anythi obvious. In both catch blocks, call printSckTrace on the exception yhou caught.
    I think the real culprit is the ~ though.
    ~ is interpreted by some (most?) shells to men home dir. However, when you just exec a command, you don't have a shell to do that interpretation for you, so it's looking for a directory that's literally named ~.
    Either exec a shell (read the man pages for the shell of your choice, but for zsh I think it's "/bin/zsh -c find ~ blah blah blah) or else just put the actual path to your home directory into the string you pass to exec. You can get that from System.getProperty("user.home").

  • Incomplete Finder find command results

    In Tiger I would use the search box in any Finder window to look for files. It would do a decent job of sorting and it displayed results sorted by "type" of file. With Leopard I cannot find folders or files in the user's Library folder (and other places). Is there a way to get Finder's find command to do a more thorough search? BTW I usually look for folders and files by name.

    system files are excluded from searches by default. to include them do the following.
    type command+f to bring up a search window. Click on "kind", scroll down and select "Other". in the resulting popup choose "system files" and set to include.

  • Finder Find command is suddenly not speedy and works weirdly

    I have a number of small, and one large, problems when I use command-F to find things in the Finder.
    After upgrading to Leopard from Tiger, like all users I experienced a WONDERFUL increase in the usefulness of this command. So I use it a lot, and for a long time it worked perfectly. My current problem is that when I type command-F, it opens a new finder window, and...
    (1) ... when I click on the box to type the words I want to find, the insertion point doesn't appear, but the letters do appear there after I type something [minor], and...
    (2) ... a FEW results of the search do appear instantly, but the window seems to enter a semi-frozen state [major; see below], and ...
    (3) ... the Finder window which is finding shows signs of being inactive (scroll bar bubble is gray, not colored; columns do not sort when column header is clicked); window is in some ways unresponsive [middling], and ...
    (4) ... after awhile (often as long as 30 or 40 seconds) the window suddenly finishes whatever was holding it up and the full set of results appear, the scroll bar bubble becomes colored, column-header-clicking sorts the column instantly.
    In short, there is now a long, weird, semi-inactive period between the initial appearance of a few Find results and the final appearance of the entire list, when I have gotten used to the seemingly 100% instantaneous appearance of a Find request's results. I'm spoiled, and I want my wonderful Find command back!
    The only thing I can think of that I might have done to contribute to this is that I HATE the behavior of the Finder searching using the title bar's oval Find window, so I removed that part from the default window setup. That is, I've changed my preferences so that when a new Finder window appears, there is no oval Find window in its upper right-hand corner. Thus, when I type command-F the Finder notices that there is no Find window to put the insertion point into, so it opens a few window with a search field at the top (the "Search for" box). (And then it refuses to put an insertion point into the window where I'm supposed to type the Search string.)
    Am I being clear?

    Did you read my hint at http://www.macosxhints.com/article.php?story=20080229204517495 ?

  • How to ignore subdirectories in find command of unix

    how to exclude subdirectories of a path from find command
    /app
    /app/fmbs
    /app/fmbs/temp
    find /app/fmbs -name *.fmb
    i want to ignore any fmb file existing into subdirectories created under temp subdirectory.
    regards

    Not sure if this helps but instead of using "find" as you are giving a specific path why not use "ls"
    Example:
    # ls /app/fmbs | grep ".fmd" (This will list all file names in specified directory)
    or
    # ls /app/fmbs/*.fmd (This will list all file names & path in specified directory)
    I hope this helps
    I am working on increasing our list of useful 1 liner commands and what we've got can be found at unbreakablehelp.com main page left hand side there are two links.
    Enjoy it.

  • Find command doesn't work

    The find command F or just Find doesn't work any ideas on fixes? I tried trashing kybrd and finder prefs. This is on a G3 running 9.2
    Thanks

    Hi, Bookalaka -
    If Sherlock, or an alias to it, is not in the Apple Menu Items folder (in System Folder), then the Find function (Command-F) will not work. If that is the case, replace that item - move either Sherlock itself, or place an alias to it, into the Apple Menu Items folder.
    Note - if you use Internet Explorer, and want to be able to use the supplemental toolbar icon for Sherlock, then Sherlock itself must be placed in the Apple Menu Items folder (IE does not recognize an alias to it).
    If for some reason you are missing Sherlock completely, you can replace it fairly easily. Look in the System Folder on any OS 9.1 or later Install CD; you'll find it in the Apple Menu Items folder. Just copy it to your hard drive.

  • LR V1.2 Having problems using the find Command

    Have just recently started using lightroom and so far managing most applications imported a series of photos and after import added keywords to them using the find function I cannot get images to appear. What seems to happen is that in the keyword tag and the folders any of the headings that contain the keyword become active the remainder show a zero no in number of images held in that folder but no images on screen
    can anyone assist me
    Peter

    thanks for the reply
    have switched of global filters, made sure that using the Find command have set keywords in "text box" and in the "rule box "contains". When I then enter a key word as soon as a type the first two or three letters
    a message appears on the screen no "No photos in the selected keyword Tag" Also when you look at the folders which have a series of numbers indicating the photos in the directory the first number in each set turns to 0 with the exception of the folder and sub folder were the images are
    So have not managed to make any progress
    Peter

  • ICal Find Command is not active

    I have tried to use the Find Command in iCal. It doesn't work either from the Edit pull down command nor the keyboard command. Can you try this in your setup and tell me whether it works?
    I have an Intel Mac Mini running 10.4.9.
    Bob Gallant

    You may want to post your question in the iCal forums:
    http://discussions.apple.com/category.jspa?categoryID=166

Maybe you are looking for

  • Error in calling a web service

    hi, i am facing a problem in calling a web service. following are the steps i followed. 1. created a client proxy object in transaction se80 2. called that proxy object in my program 3. executed the program problem 1. an exception 'CX_AI_SYSTEM_FAULT

  • Call function within rfc

    Hi, i´ve developed an RFC FM and within this FM i use     CALL FUNCTION ' NUMBER_GET_NEXT' in order to get a sequential number each time the FM is called. When this RFC FM is called from XI i get exception 1 (INTERVAL_NOT_FOUND)  Why is this happenin

  • Alias URL for sender SOAP

    Hi Friends, We are working on SOAP to RFC Scenario. We would like to expose different URL instead of   * http://host:port/XISOAPAdapter/MessageServlet?channel=party:service:channel * where it specifies the business service and communication channel a

  • WS-Security: "Could not validate the signature..."

    Hello, We get the following fault when calling a web service demanding signature: <soapenv:Fault xmlns:wsse="...."> <faultcode>wsse:InvalidSecurity</faultcode> <faultstring>Could not validate encryption against any of the supported token types</fault

  • Installing OBIEE patch on Unix

    Hi Any body has a document or link that explains how to install OBIEE patches on Unix Env? Thanks