![변수에 새 줄을 사용하여 명령을 추가하는 방법은 무엇입니까? [복사]](https://linux55.com/image/102856/%EB%B3%80%EC%88%98%EC%97%90%20%EC%83%88%20%EC%A4%84%EC%9D%84%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%EB%AA%85%EB%A0%B9%EC%9D%84%20%EC%B6%94%EA%B0%80%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F%20%5B%EB%B3%B5%EC%82%AC%5D.png)
아시다시피 list=$(ls -l)
추가된 모든 파일을 작성하면 $list
다음과 같습니다.
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
$list
다음과 같이 삽입하려면 어떻게 해야 합니까 ?
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
답변1
$list
이미 이런 형식으로 되어있습니다. 따옴표 사용:
echo "$list"