como adicionar o comando com nova linha nas variáveis? [duplicado]

1

como você sabe quando escrevemos list=$(ls -l) , todos os arquivos adicionados a $list gostam disso:

total 0 drwx------ 7 mine-pc staff 238 Dec 22 11:32 Applications drwxr-xr-x@ 6 mine-pc staff 204 Jan 11 11:00 Applications (Parallels) drwx------+ 21 mine-pc staff 714 Jan 9 22:33 Desktop drwx------+ 33 mine-pc staff 1122 Jan 7 23:43 Documents drwx------+ 83 mine-pc staff 2822 Jan 11 00:42 Downloads drwx------@ 71 mine-pc staff 2414 Dec 22 01:10 Library drwx------+ 21 mine-pc staff 714 Jan 10 23:48 Movies drwx------+ 4 mine-pc staff 136 Sep 27 17:48 Music drwxr-xr-x 5 mine-pc staff 170 Jan 4 16:25 Parallels drwx------+ 9 mine-pc staff 306 Dec 29 13:06 Pictures drwxr-xr-x+ 5 mine-pc staff 170 Sep 27 15:41 Public

como posso inseri-lo em $list da seguinte forma:

drwx------   7 mine-pc  staff   238 Dec 22 11:32 Applications
drwxr-xr-x@  6 mine-pc  staff   204 Jan 11 11:00 Applications (Parallels)
drwx------+ 21 mine-pc  staff   714 Jan  9 22:33 Desktop
drwx------+ 33 mine-pc  staff  1122 Jan  7 23:43 Documents
drwx------+ 83 mine-pc  staff  2822 Jan 11 00:42 Downloads
drwx------@ 71 mine-pc  staff  2414 Dec 22 01:10 Library
drwx------+ 21 mine-pc  staff   714 Jan 10 23:48 Movies
drwx------+  4 mine-pc  staff   136 Sep 27 17:48 Music
drwxr-xr-x   5 mine-pc  staff   170 Jan  4 16:25 Parallels
drwx------+  9 mine-pc  staff   306 Dec 29 13:06 Pictures
drwxr-xr-x+  5 mine-pc  staff   170 Sep 27 15:41 Public
    
por Freeman 11.01.2017 / 09:43

1 resposta

1

$list já está nesse formato. Use aspas:

echo "$list"
    
por 11.01.2017 / 09:45