Wednesday, May 8, 2024
18
rated 0 times [  18] [ 0]  / answers: 1 / hits: 18547  / 3 Years ago, sat, august 21, 2021, 12:27:31

I have a text-based game, Colossal Cave Adventure, that I would like to launch with a shell script instead of opening the terminal and typing cd ~/Desktop/CCA and ./Adventure. The code I am trying to use is this:



#! /bin/bash
gnome-terminal -e 'cd ~/Desktop/CCA/; ./Adventure'


and the message i receive is this:



There was an error creating the child process for this terminal
Failed to execute child process `cd` (No such file or directory)


with options to change profile preferences or relaunch the process. I have also tried using the absolute path instead of ~/, and all of my file names are correctly spelled and point to the right place. What is wrong?


More From » gnome-terminal

 Answers
7

cd is a shell builtin. you should use this:



#! /bin/bash
gnome-terminal --working-directory=/home/username/Desktop/CCA/ -e './Adventure'

[#24949] Sunday, August 22, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hirtieve

Total Points: 207
Total Questions: 104
Total Answers: 114

Location: Cook Islands
Member since Thu, May 21, 2020
4 Years ago
;