New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post005 - How to Energize a Scary Terminal With Little Scripts #4

Open
vijayabharathib opened this Issue Nov 23, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@vijayabharathib
Copy link
Contributor

vijayabharathib commented Nov 23, 2017

This issue is to capture any trouble using the snippets from How to Energize a Scary Terminal With Little Scripts.

@yjose

This comment has been minimized.

Copy link

yjose commented Dec 24, 2017

Hi @vijayabharathib.
first, thank you for this amazing tuto.
I'm also using elementary with oh-my-zsh terminal and I have a problem using your script bash to run my project workflow.
My problem is that the workflow script doesn't execute the command after opening the new pantheon terminal.

my script bash

#!/bin/bash  
export WORK_DIR="/media/disk2/Work/my_react/reactjs-popup" 
code $WORK_DIR 
pantheon-terminal -e 'bash -c "npm run storybook"'
@vijayabharathib

This comment has been minimized.

Copy link
Contributor

vijayabharathib commented Dec 26, 2017

Hello @yjose , two things different on your script when I compare mine.

  1. You need to cd into the WORK_DIR before you run npm run.
  2. The way double quotes and single quotes are used also matters (which I didn't know until now).

So here is another version for you that might work (it just ran ok on mine - though I didn't have npm run storybook).

export WORK_DIR="/home/your/folders" 
code $WORK_DIR 
pantheon-terminal -e "bash -c 'cd $WORK_DIR;npm run storybook'"

If you take a closer look, we start bash command with double quotes. "bash -c..." not 'bash -c'. Inside those double quotes, I've used single quote. When I change it, the script didn't run.

One last thing, your path shows that you are trying to use a drive that need to be mounted. Please ensure your drive is mounted before you run this script.

@yjose

This comment has been minimized.

Copy link

yjose commented Dec 26, 2017

Hello @vijayabharathib, I have tested Two approaches to solve my problem without success !!!

  1. when I run your script, it just open vs code and a new terminal without executing the command
  2. I execute the last line script inside my terminal and it's the same, Just a new terminal
  3. I repeat those two test with simple terminal bash (zsh disable ) and also it's the same.

thanks

@klvenky

This comment has been minimized.

Copy link

klvenky commented Jan 24, 2018

Hi @vijayabharathib,
Thanks for the great article. I am very happy to find something which I was looking for.
However, I need some help as things didn't go simple for me with the following snippet.

export WD="~/dev"
code -n $WD/reports.code-workspace 
gnome-terminal \
--tab --working-directory=$WD/reports-ui -- yarn start \
--tab --working-directory=$WD/reports-query-server -- yarn dev

here it just opens a new file with vscode and then does nothing. I didn't understand if I'm missing something around here.

@vijayabharathib

This comment has been minimized.

Copy link
Contributor

vijayabharathib commented Feb 4, 2018

Hi @klvenky , all looks ok, except the way you run yarn start. It did not work directly on gnome terminal. This gist has a working copy that I used on gnome-terminal.

https://gist.github.com/vijayabharathib/a5e9c314c7309b1dcb74af51dba69aa9

an excerpt from the gist to give you an idea

export WORK_DIR="/home/username/Projects/pineboat/development"

gnome-terminal \
--tab --working-directory=$WORK_DIR \
-e 'bash -c "export BASH_POST_RC=\"npm start\"; exec bash"' \
--tab --working-directory=$WORK_DIR \
-e 'bash -c "export BASH_POST_RC=\"atom $WORK_DIR\"; exec bash"'

By the way, I am not sure why vscode opens a new file, I haven't tried using a workspace. But folders open just fine with above commands.

@yjose looks like we hit a wall there. sorry, no other solution sparked in my head.

@klvenky

This comment has been minimized.

Copy link

klvenky commented Feb 6, 2018

Hi @vijayabharathib,

Thanks for clarification. However it's not working for me :(

#!/bin/bash
export WD="/home/venkatesh/dev"

gnome-terminal \
--tab --working-directory=$WD/backend \
-e 'bash -c "export BASH_POST_RC=\"docker-compose up\"; exec bash"' \
--tab --working-directory=$WD/backend \
-e 'bash -c "export BASH_POST_RC=\"yarn dev\"; exec bash"' \
--tab --working-directory=$WD/frontend/ \
-e 'bash -c "export BASH_POST_RC=\"yarn dev\"; exec bash"' \

Not sure what's the issue. Please clarify :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment