EDIT : 해결 된 해결책을 찾았습니다. 파일 경로를 인용하여 전체적으로 읽혀 지도록하는 것이 중요합니다.Osx 터미널 : 파일 경로가 명령의 출력 인 하나 이상의 폴더/파일을 여는 방법
path_to_open=$(gfind ~/x/y/ | gshuf | ghead -n 1) && open "${path_to_open}"
osx의 터미널에서 사용하려는 명령을 작성했습니다. 디렉토리의 파일 및 폴더 경로 목록을 가져오고 셔플 한 다음 셔플 후 txt의 첫 번째 줄에있는 경로를 가져옵니다.
이
은 내가 지금까지있어 무엇 : [1]gfind ~/x/y/ | gshuf | ghead -n 1 > ~/Desktop/z.txt
와
gfind ~/x/y/ | gshuf | ghead -n 1
내가 .txt 인의 I이 파일이나 폴더의 경로를 작성하는 대신이 형식 /Users/me/x/y/some folder/some file.txt
의 파일 경로를 얻을 마치 내가 그것을 파인더에서 두 번 클릭 한 것처럼 열려고합니다. 어떻게해야합니까? 나는 공개 명령 [2]이 설명서 페이지의 설명에 기반한 올바른 도구라고 생각했지만 정확히 어떻게 사용하는지 잘 모르겠습니다. 어떻게 사용해야합니까? 또는 잘못된 명령 인 경우 어떤 명령을 사용해야합니까?
[1] 내가 익숙한 명령 이름 앞에 AG가 왜
[2]
open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-b <bundle identifier>] [-a <application>] [filenames] [--args arguments] Help: Open opens files from a shell. By default, opens each file using the default application for that file.
If the file is in the form of a URL, the file will be opened as a URL. Options: -a Opens with the specified application. -b Opens with the specified application bundle identifier. -e Opens with TextEdit. -t Opens with default text editor. -f Reads input from standard input and opens with TextEdit. -F --fresh Launches the app fresh, that is, without restoring windows. Saved persistent state is lost, excluding Untitled documents. -R, --reveal Selects in the Finder instead of opening. -W, --wait-apps Blocks until the used applications are closed (even if they were already running). --args All remaining arguments are passed in argv to the application's main() function instead of opened. -n, --new Open a new instance of the application even if one is already running. -j, --hide Launches the app hidden. -g, --background Does not bring the application to the foreground. -h, --header Searches header file locations for headers matching the given filenames, and opens them.
흠. 이것은 시도 할 때 제일/"마지막 활성"창에서만 찾기 시작합니다. –
즉. 이 방법은 작동하지 않으며 파인더 만 열립니다. –
문제는 대부분의 파일에 공백이 있다고 생각합니다. 인용 된 명령의 결과를 전달하는 방법을 보여 주실 수 있습니까? –