EMBED YOUR TERMINAL RECORDINGS ONLINE

Dont use ls but glob instead

DATE: 2013-12-08
AUTHOR: Coder of Salvation
AUTHOR WWW: http://leon.vankammen.eu/tech/index.html
RELATED ARTICLE: http://mywiki.wooledge.org/BashPitfalls

Related recordings:

CAT COMMAND IN LINUX

tags: cat unix gnu linux view file textfile editing
LIST DIRECTORIES IN LINUX WITH LS

tags: ls directory show content linux disk beginner
SUTRAPHP-INTRODUCTION

tags: sutraphp sutra php console cli eventbased
MORE OVERVIEW IN MYSQL WITH SELECTS

tags: mysql, select, more overview, console
M4, THE HIDDEN GNU TREASURE

tags: m4, gnu, macroprocessor, template, search, replace, sed
THE UNIX TREE COMMAND

tags: unix console tree bash directory listing
DEVTODO: COMMANDLINE TODO MANAGEMEN

tags: todo xml tasks productivity management
VIM ALIGN

tags: vim align aligning text text editing text trick
VISUAL SELECTS IN VIM

tags: vim visual selects regex text editing fast
GENERATING PHP & SQL (MAPPING) CODE

tags: sutra generate sql generate database php cms mysql

Bookmark and Share
EMBED THIS RECORDING:
<div><script id="playterm-MjAxMy0xMi9kb250dXNlbHN0dHlyZWMtMTM4NjUwNzkzNXw4MHgyNA==" type="text/javascript" src="http://playterm.org/js/?hash=MjAxMy0xMi9kb250dXNlbHN0dHlyZWMtMTM4NjUwNzkzNXw4MHgyNA==" class="size:80x24"></script></div>
I recorded this `dont use ls but glob instead` shellsession because it is very easy to miseducate
yourself concerning bashscripting.

Do yourself a favour and use bash arrays. Run this in your console and you'll understand:

  files=(*)
  echo "${files[0]}"
  echo "${files[@]}"
  echo "${files[@]:0:2}"

Use this instead of using ls.
This will prevent you a lot of trouble,hassle and lot of code.

 

Name   
Email (never shown)  
Comment