Thread: Multidimensional arrays in Korn shell

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    224

    Multidimensional arrays in Korn shell

    Hello,
    How do you implement multidimensional arrays in Korn shell. I have to implement popd and pushd in ksh, and I'm thinking about implementing them with arrays. I want to have an inode-like structure for the stack (in case you have more than 1024 directories).
    Thanks,
    Yasir

  2. #2
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    Ok, there are no multidimensional arrays. Is there a built in way to count the number of words in a string?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Here's one way...
    echo $string | wc -w
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    Thanks, but is there a shell built-in that would do the same? I would perfer not to fork another process to determine the number of words.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multidimensional Arrays
    By jordanguyoflove in forum C Programming
    Replies: 4
    Last Post: 10-16-2008, 06:16 PM
  2. Multidimensional Arrays?
    By CreatedByShadow in forum C++ Programming
    Replies: 7
    Last Post: 01-13-2006, 10:35 PM
  3. Pointers to Multidimensional Arrays
    By kidburla in forum C Programming
    Replies: 10
    Last Post: 10-29-2005, 10:45 PM
  4. Implementing ! functionality for Korn shell
    By Yasir_Malik in forum Linux Programming
    Replies: 1
    Last Post: 06-14-2004, 08:24 PM
  5. Implementing ! functionality for Korn shell
    By Yasir_Malik in forum Tech Board
    Replies: 1
    Last Post: 06-13-2004, 05:27 PM