Dumb bash question

I'm doing a develop work and need to quickly change from one folder to another. So i created a simple script
cd /folder1/folder1-sub1/folder1-sub2/
save it as 'docdir', and chmod 755 docdir
then
./docdir
nothing happens
What I expect to happen is to change from login folder to new /folder1/folder1-sub1/folder1-sub2/ but no change?????? also no error??
thanks Mike

Sorry but I find my mistake amusing. It worked but I didn't know what I was telling it to do.
So If I understand you correctly what I did was move the scripts shell from one directory to another. So to continue on that thought one could write a script that way (alright it probably wouldn't make sense to do that, but you could)
To see if I understand the difference, these totally arbitrary examples
call bash shell,
cd /var
cat filenames | grep march > /tmp/changes.txt
cd /var/apache
cat filenames | grep march > /tmp/changes.txt
cd /tmp
grep -i am changes.txt > morningchanges.txt
Where we normally would do this by calling those files with the folder location
cat /var/filenames | grep march > /tmp/changes.txt
cat var/apache/filenamesdiferentfolder | grep march > /tmp changes.txt
grep -i am changes.txt > morningchanges.txt
well let me know if I understood it.

Similar Messages

  • Dumb newbie question -- shell vrs linux console

    This is probably a dumb newbie question, but what is the difference between the shell screen and the linux console screen? I used another system before Arch and I believe there was only the shell screen! Does it matter which one is used?  Thanks -- Larry

    The console is the 2D text rendering thing. The shell is Bash, just a program that handles your input and has the console as output.
    If on the other hand you mean the console at startup, and you call that the console while you call xterm, etc. shells then the answer is different. It's just a matter of configuration if you automatically start X or not. A lot people use gdm or kdm to get a graphical login screen after bootup, others just type "startx" in the console when they want to start X.
    You can switch to the console with Ctrl+Alt+Fn where n is a number between 1 and 6. You can switch between consoles with Alt+Fn, X is on the last console, so to go back to X do Alt+F7.

  • Dumb newbie question on iphone development

    Hi there, just a quick dumb question: Can i develop Iphone apps in Windows platform? This is b'coz I dun have Mac machine.

    a simple answer is YES in opposite of what you read here.
    +I'm a .NET developer and I started building web apps in .NET (ASP.NET).+
    The iPhone/iPod Touch supports 2 different ways to develop something for it, a Web Application (applications that runs on Safari browser, like Facebook and Wordpress) and a SDK Application (Self contain applications, like games, utilities, etc). *Under Windows, you can do any Web Application*, you will need a Mac to do SDK Applications
    Reading the Wrox book entitled: Professional iPhone Application Development (ISBN 0470251557) in page 5 the writer tells about 4 levels to do Web Apps:
    *Level 1 - Full compatible website/application*
    The ground level approach is to develop a Web site/app that is “ iPhone/iPod touch – friendly ” and is fully compatible with the Apple mobile devices. These sites avoid using technologies that the Apple mobile devices do not support, including Flash, Java, and other plug - ins. The basic structure of the presentation layer also maximizes use of blocks and columns to make it easy for users to navigate and zoom within the site. This basic approach does not do anything specific for iPhone/iPod touch users, but makes sure that there are no barriers to a satisfactory browsing experience.
    (just like http://del.icio.us/
    *Level 2 - Web site/application optimized for Safari*
    The second level of support for iPhone and iPod touch is to not only provide a basic level of experience for the Mobile Safari user, but also to provide an optimized user experience for users who use Safari browsers, such as utilizing some of the enhanced WebKit CSS properties supported by Safari.
    *Level 3 - Dedicated iPhone/iPod Touch web site/application*
    A third level of support is to provide a Web site tailored to the viewport dimensions of the iPhone and iPod touch and provide a strong Web browsing experience for Apple device users. However, while these sites are tailored for iPhone/iPod touch viewing, they do not always seek to emulate Apple UI design. And, in many cases, these are often stripped - down versions of a fuller Web site or
    application.
    (just like Amazon.com and Facebook)
    *Level 4 - Native - looking iPhone/iPod touch application*
    The final approach is to provide a Web application that is designed exclusively for iPhone and iPod touch and closely emulates the UI design of native applications. One of the design goals is to minimize user awareness that they are even inside of a browser environment. Moreover, a full - fledged iPhone application will, as is relevant, integrate with iPhone - specific services, including Phone, Mail, and Google Maps.
    I did 2 web apps using Dreamweaver for Windows, using Level 4, coding plain HTML - there is no visual aid, but you just pick up an iPhone/iPod Touch (or if you don't have this, use Safari browser or any WebKit Browser).
    You can always start here
    Remember, if you really want to build a self contain application in Objective-C/Java, then you need a Mac running Leopard (Mac OS X 10.5), with XCode (the Mac Visual Studio) and the iPhone SDK
    Hope that with this you can see some light under Windows

  • A really dumb Mail question

    Like the subject says, I have a really dumb question.
    This morning, my IMAP went nuts, and I spent about an hour trying to fix it. Everything seems to be normal now, and Mail is back up and running (hopefully). But now I noticed something, whenever I get new mail, the number of unread emails doesn't show up to the right side of the main inbox like it does with the other mailboxes I created.
    I have rules set up, so certain emails go to certain folders, and those folders display the number of unread messages inside. But not the main inbox.
    So now I'm wondering if that was always the case, and this is just paranoia left over from the email mess this morning, causing me to notice something that might have never been there in the first place.
    Thanks for any help

    Ernie:
    The folders are on the IMAP server, and not On My Mac.
    Most messages that don't fall under the rules will go to the default inbox.
    For those messages that are moved, a number counting the amount of unread messages will show up next to the folder.
    Fioba:
    That sounds like a good idea, but it seems counter intuitive to need to create a smart mailbox for unread messages, when that is the purpose of the inbox itself.

  • [SOLVED] alias or bash question

    Hello all,
    I just need a liittle help on alias or bash
    Right now, I want to run vim on xterm. So I always invoke
    xterm vim
    Everything works fine but when I manually add a directory or a directory of a file, something like
    xterm vim /directory/of/file_here
    It won't work.
    This is like manually opening a file in gvim or any app.
    I just want vim to run on xterm.  This is like clicking a file and open with gvim ('xterm vim' in this case).
    I'm currently using KDEmod4.2
    Last edited by ragingmon (2009-02-22 11:08:21)

    yay!! thanks a lot droog!!!
    that was really fast.
    marked as solved..

  • Dumb newbie question number 2!  - Table problem....

    Since my first question was answered so well, I thought I'd try a second!
    This one has me stumped. We have a Stellent content development and seperate live server. While developing the web site, I had no issues with content. Certain pages contain MS Word Native content and they appeared with no problem.
    Now we have our content moved to the live server, the tables in the word documents are appearing as black with white text, instead of white with black text. Some tables even show up as black on black.
    I don't manage the Stellent Content servers (I just use site studio) but my collegue has looked and can't see any difference between the live/develop content servers. I can't understand why I've got two different results for the same content! Any ideas??
    Many thanks!
    Jeanette

    Hi again Jeanette,
    You probably are using a conversion of the document and the conversion is not working fine.
    Look for this document in content server and check both versions (native and Web) in both servers.
    Alejandro

  • Possibly dumb iCal question...

    Hi I apologize in advance if this is a stupid question, but I can't seem to find a way around it.
    We have a Leopard Server and several Leopard clients, what I would like is some central calendars that everyone has the ability to edit. I can do this using the web calendars that leopard server creates based on security groups but what I really need is the ability to have calendars connected to everyone's iCal that multiple people can edit.
    So for example in my iCal I create an appointment and then someone else in their own iCal (on a different machine) can go in and edit/ delete that same appointment.
    Is there currently a way to do this using leopard that anyone has successfully done, ideally it would need to work for multiple calendars and be hosted on the server. It seems like it should be REALLY easy. I hope it is and I just haven't figured it out yet...
    Thanks for the help in advance!

    Hi
    Ideally the Server should be an OD Master, DNS must be running somewhere on the network with appropriate records created. Of course iCal and Web Services should also be running. Once you have done that you join the clients to the LDAP Directory using Directory Utility. You don't have to use the Server as the main DNS Server for the clients but it works better if you do. You don't have to use authenticated directory binding and you don't need to create home folders or log in to networked accounts. Next launch iCal > Preferences > Accounts and click + icon. In the user name field key in a user name (must be the shortname) that exists in the LDAP node. It should autofill for you. You should not need to do anything else apart from supplying the password.
    Once the calendar has been created you can delegate who can access it. To delegate you simply use the same method in creating the account to find other users. If DNS is as it should be it should autofill. By the side of each name is a tickbox as well as options to define read/write access. You should now be able to see each other's calendars, see changes as well as make changes. They should be able to do the same with yours.
    Although the iCal Admin Manual so far has been next to useless - although to be fair it has been updated recently so maybe they may contain something useful? - you should download it as it should list further options you may be interested in. I would also download the Command Line Manual as well. You are going to need it.
    http://images.apple.com/server/macosx/docs/iCalService_Admin_v10.5_2ndEd.pdf
    http://images.apple.com/server/macosx/docs/CommandLine_Adminv10.5.pdf
    and
    http://www.apple.com/server/macosx/resources/
    for the rest.
    Tony

  • Quick Bash Question

    I'm trying to write a simple bash script which downloads the compat-wireless drivers and installs them. The script works fine but i'm trying to learn bash and would like to make it a bit nicer to look at and add some more functionality. What I have done is used grep to pull out the percentage of the download, however every number prints on a new line like so:
    1%
    2%
    3%
    4%
    5%
    6%
    etc.... What I'm trying to do is replace the last percentage with the next one, so it's all on one line. I've had a look around and found that a way to do what I'm trying to do is with:
    tput cbt
    or with the bash escape codes directly. Now the thing is I don't know where I should put this in my code, could anyone help?
    #!/bin/bash
    #Retrieve latest compat-wireless soruces
    echo -e "Downloading sources\n"
    wget http://wireless.kernel.org/download/compat-wireless-2.6/compat-wireless-2.6.tar.bz2 |& grep -o "[0-9]\+%"
    if test -fs compat-wireless-2.6.tar.bz2 then
    echo "File Downloaded OK"
    else
    echo "Download Failed, Exiting."
    exit
    fi
    #Untar folder
    echo "Extracting sources"
    tar jxvf compat-wireless-2.6.tar.bz2 > /dev/null
    #Enter build folder
    cd compat-wireless-*
    #Select ath9k as driver to build
    ./scripts/driver-select ath9k
    #Compile sources
    make
    #Install sources
    sudo make install
    #Unload wireless modules
    sudo make unload wireless
    #Reload ath9k module
    sudo modprobe ath9k
    #Return to original directory
    cd ..
    #Remove traces of install files
    sudo rm -r compat-wireless-*

    Ok, so I've tried
    #Retrieve latest compat-wireless soruces
    echo -e "Downloading sources\n"
    wget http://wireless.kernel.org/download/compat-wireless-2.6/compat-wireless-2.6.tar.bz2 |& printf "\r `grep -o "\r[0-9]\+%"`"
    To no avail, am I doing this correctly, or at least on the right lines? I can't seem to find any examples where a command is used within a printf statement.
    Thansk for the help so far!
    edit: Just a thought, could I possibly encompass the grep command into a variable and then pipe it into a printf statement?
    Last edited by jack.mitchell (2011-01-18 15:50:19)

  • (hopefully) simple, dumb swingworker question

    I'm experimenting with Swing for the first time, after coming from PHP (non-threaded, non-GUI, etc). I'd like to build a button that does some long-running background task, so, working my way through Sun tutorials, I've come to SwingWorker. I understand some of it, but the major sticking point to me right now is getting data back from the thread. For instance, if my thread were to go out and do some calculation...how do I get that back in the EDT to display it? I gleaned that I should only affect the GUI from the EDT ... correct? I've created a second class to model the worker task. My code (some auto-generated by netbeans) is below:
    ++++++++++++++++++++++++++++++++++++++ MainFrame.java ++++++++++++++++++++++++++++++++
    package swingworkertest;
    public class MainFrame extends javax.swing.JFrame {
    /** Creates new form MainFrame */
         public MainFrame() {
              initComponents();
         /** This method is called from within the constructor to
          * initialize the form.
          * WARNING: Do NOT modify this code. The content of this method is
          * always regenerated by the Form Editor.
         @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            goButton = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            goButton.setText("Go");
            goButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    goButtonActionPerformed(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(58, 58, 58)
                    .addComponent(goButton)
                    .addContainerGap(59, Short.MAX_VALUE))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(44, 44, 44)
                    .addComponent(goButton)
                    .addContainerGap(56, Short.MAX_VALUE))
            pack();
        }// </editor-fold>
         private void goButtonActionPerformed(java.awt.event.ActionEvent evt) {
              WorkerTask workerTask = new WorkerTask();
              workerTask.execute();
          * @param args the command line arguments
         public static void main(String args[]) {
              java.awt.EventQueue.invokeLater(new Runnable() {
                   public void run() {
                        new MainFrame().setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JButton goButton;
        // End of variables declaration
    }+++++++++++++++++++ WorkerTask.java ++++++++++++++++++++++
    package swingworkertest;
    import javax.swing.SwingWorker;
    public class WorkerTask extends SwingWorker<String, Integer> {
         private Throwable error = null;
         /** The function that is running in the worker thread */
         @Override
         public String doInBackground() {
              String ret = "this is my returned data";
              System.out.println("I'm in doInBackground, with data ["+ret+"]");
              return ret;
         @Override
         public void done() {
              String data = null;
              try {
                   data = get();
                   System.out.println("Hey, I'm in done(), and have data");
                   System.out.println(data);
              } catch (Exception ignore) {
                   System.out.println("Oh yea, got an exception in done");
              return;
    }+++++++++++++++++++++++++++++++++++++++++++++++++++
    So, once my thread runs, how do I get back the data so it can be displayed (or put into some other Swing component)? Is there an event listener I should be using? Something along those lines?
    Any help, or even a point in the correct direction, would be very helpful.
    Thanks in advance!
    Edited by: crotty on May 13, 2010 2:01 PM

    Hi, camickr, thanks for your response. I guess my question might be one of scope then. I understand that done() and process() are run on the EDT, but when done() (for example) is run, it's run in the scope of the WorkerTask class (which is a separate class outside of my main class, and not a inner class). So the WorkerTask class doesn't have access to the private Swing components, like goButton in my example.
    I put the WorkerTask class outside because it seemed to me that these tasks would be easier to work on if they were separate from the main EDT class, however, that may not be the case. Is it better practice to put SwingWorker extending classes as inner classes in the main class, and use other classes to actually do the work? (And how many times can I use the word class in one sentence?)
    In any case, the done() method call is performed (and has access to the computed data via get()), but doesn't seem to return anything to the EDT in a place where I have programmatic access to it, or a place where I can alter any swing components. If I'm wrong (which is most likely the case), could you point me towards where I've gone wrong?

  • Another dumb overlay question..

    hi, sorry to bother you all with a redundant overlay file question but ive scoured the forum and still cannot wrap my mind around this process and what i am doing wrong.
    heres what i have done, following step-by-step the lynda.com tutorial:
    1. import a 720x532 still of my menu BG.
    2. i create my overlays, in this case, 3 white stars, next to my 3 menu titles.
    3. i deactivate the visibility of the background, leaving a transparent screen with my 3 white stars.
    4. i save as a tiff, as a copy (no layers). i have tried saving while ticking the "Save transparency" as well as without it.
    5. i import the tiff file into DSP(v.4), set as Overlay File, then drag my button over the first menu title, but no star appears.
    WHAT AM I DOING WRONG I AM LOSING MY MIND AHH!!!
    please help, thanks in advance!
    -brooks

    Go back to your photoshop file, make the three white stars into three black ones instead, on a white background. Export this as a .pict file and use it as the menu overlay.
    In DVDSP, draw out the button rectangles. Set the colours for the buttons to be simple overlay type, and set the normal state to be black and zero opacity. Now set the selected state to be white and full opacity. You can choose another colour for the activated state - try red - and also set this to full opacity.
    What should happen is that the default button will start off with the star and moving from button to button will make the star appear on each as you go.

  • Dumb, newbie question about Quicktime

    I recently switched from PC to Mac, so I do not have much experience using Quicktime, rather than WMP. My question is this: Can I configure Quicktime to open internet videos in an external player, rather than in the web browser? The reason for the question is that the videos playing in the browser are very small, and I don't see a way of increasing the display size. Any help is appreciated.
    iMac   Mac OS X (10.4.7)  

    The Web page authors decide what size is displayed. They can also send the linked file directly to the QuickTime Player so it opens in its own window.
    Users (viewers) can't adjust the size if the file is told to open via the browser plug-in.

  • Really dumb newbie question

    ok how do you change the text of a label for a form field, I drilled down to edit the layer its on, its property has it as dynamic, which doesn't make sense because it is static, but I don't care about that just how do I actually get to the text and change it. I would have thought it would simply be in the properties of the label. there is help that gets invoked when hovering over the label, is that perhaps what is making changing the label text so obscure to me at this point. see pic of where I'm at, don't know how to make the pic bigger and more readable, but its got the properties for the label open at the bottom and  the dropdown box is 'dynamic' but I'm not seeing where the actual text is stored.

    If you select the textfield and in the Properties panel you see <Instance Name>, then any text the textfield has in it is text that is typed into it because without an instance name assigned there is no way you can use code to assign the instance name.  So just edit the text directly in the textfield by typing in it.
    I'll take that back if it happens to be an AS1/AS2 file... in those versions it is possible to assign a variable to the textfield instead of an instance name (bad practice, but it can be done).  So if you see something entered in the Properties panel field labeled "Var:", then you might find some code assigning a value to the textfield that way.
    But if the first image you showed is one of the textfields in question, just edit the text you see directly in the textfield because it has no instance name nor Var assigned to it.  And while you're at it, change it to a static textfield... static textfields are easier to manage display-wise and avoid font issues that might come up with dynamic textfields.

  • [Solved] Quick Bash Question

    Ok, I have a loop and I want to count the number of times the loop occurs in my script. Every time the loop occurs there is an output. I want during the loop to display 1 - infinite number until the loop stops.
    Do you know what I am getting at?
    Last edited by haxit (2009-02-13 18:04:37)

    Ok, so I have this script:
    #!/bin/bash
    if [ -z "$1" ]; then
    echo "Please run like so: 'sh "$0" <highest number on dice>'"
    else
    WOW=`echo "$1*2" | bc`
    for X in 1 2 3; do
    ONE=`seq 1 $1 | sort -R | head -1`
    TWO=`seq 1 $1 | sort -R | head -1`
    HAH=`echo "$ONE+$TWO" | bc`
    until [ $HAH -eq $WOW ]; do
    ONE=`seq 1 $1 | sort -R | head -1`
    TWO=`seq 1 $1 | sort -R | head -1`
    HAH=`echo "$ONE+$TWO" | bc`
    NUM=`echo "1"`
    echo "$HAH" >> probability.log
    done
    LOL=`cat probability.log | wc -l`
    echo "$LOL"
    rm probability.log
    done
    fi
    It gives me three outputs, I want to add those outputs and divide them by 3.

  • (hopefully) really dumb xcode question

    I've got a project that I'm porting from metrowerks to xcode. I've done this several times before without this problem, but for some reason now, the .rsrc file that should become part of the new app bundle is getting zeroed out.
    It's in the resources section of the xcode project, and when I delete (rename) the original .rsrc file, it goes red, and won't compile, so it's looking at the right file. However, when I put it back and compile, when I look into the bundle (that's a REALLY helpful new feature in the OS, I love it) it shows up as zero size (the original is 24K) Also, it has a different icon. When I try to run the app, it doesn't have any of the menus which are stored in the resource, so it isn't there.
    Also, when I manually copy the original rsrc file into the bundle, it seems to work, so I know what's going wrong, just not why..
    any thoughts? thanks

    Ok, not as dumb as I'd feared, but it seems that xcode doesn't like rsrc files that are in the resource fork? so I did a deRez and then a Rez with -useDF to make the same resource file, but in the data fork... looks like it works, at least for now.

  • Dumb printing question

    I think I'm being really dumb.
    I'm trying to print multiple copies of a document. The print dialog never asked
    whether I want to print more than one copy.
    I'm using HP3310 printer in Leopard.
    Any ideas??

    I had trouble with the exact same issue.... in the box that one would expect the option of "how many copies", there is a little triangle -- click on that and you get all the options you want!!
    Hope this works for you, too!

Maybe you are looking for

  • Tab limited input in Sender FTP adapter

    Hi ,    We are working on a scenario where by the file format in the incoming FTP adapter is tabdelimited...All  fields are seperated by '#'...Will XI be able to split the fields based on '#' and do the content conversion ??? What would be the parame

  • Does windows have a problem with iDVD DVDs?

    Works fine on Mac Works fine on Playstation Works fine on B&O DVD Doesn't work fine on Wintel PC. The DVD buttons are only sometimes activated - mosty they are not recognised and don't function. When they do function, it's only by pressing a little "

  • Missing information

    I have songs that I have downloaded. I have them on itunes, and I can see them on my IPOD in the songs list. However, when I search by artist or genere on my IPOD, I do not see the songs. I have triple checked to make sure the artist name and genere

  • SAX Entity References

    Hi, I am currently trying to fix create software using SAX. I am parsing XML files and allowing them to be searched and modified and also offering the option to write them back to a file. However, in the input files there are entity references such a

  • Problem with validating my RSS Feed

    Hi, Been trying to submit my podcasts to iTunes but got a problem as it keeps coming up saying 'We had difficulty downloading episodes from your feed'. My feed is: http://feeds.feedburner.com/MarkandNinashow and when i check it on feedvalidator.org i