Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

ls-la put in array

array ls-la

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 robzuclm

robzuclm

    CC Newcomer

  • Member
  • PipPip
  • 19 posts

Posted 27 May 2014 - 08:30 PM

Hi i would like to know if this thing is possible in bash getting the ls-la in a directory then put it in array element

 

array =('ls-la /var/www/subdomains);

 

echo {array[0]}

 

is this possible that im going to output thru array



#2 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts

Posted 28 May 2014 - 12:21 AM

Okay, so first things first:

 

ls -la is going to give you a bunch of extra information in a way that's not possible to put into an array. You probably want something like ls -fb and then parse that into an array, am I correct?


sudo rm -rf / && echo $'Sanitize your inputs!'