Skip to content
Coding Fanatic
  • Android Development
  • News and Reviews
  • Road2Pro
  • Tutorials
  • Services
  • About

Slow Times, 9/100 Days of Code

  • November 14, 2018March 25, 2019
  • by Richard Clarke

The best part of programming is those slow moments of realization

I worked on a bash script for running a program via the terminal. I started by creating two variables in my bash profile. 

The first would change to a parent directory of another directory containing Cypress. The second would go deeper into the child directory to open Cypress. When executed one by one, this worked no problem. However, that’s the problem. I used TWO variables to perform ONE task. But before I figured this out, I did a fair bit of head banging.

I tried piping the output of the first variable into the second, spacing them out when entering them into the terminal. Eventually, I gave up on using the terminal for this task. I resorted to scripting. I figured if I wrote a script that used both variables in succession, I could get it to work. More head banging, and still nothing. The day ended, and I decided to leave this issue alone for the next day.

The next day, I’m stretching after a run when it finally hits me, “Why not use one variable?” It was obvious! I laughed to myself for a moment. See, instead of executing cyNavi to navigate to one directory, and cyStart to navigate/start Cypress, I could just type the entire directory to Cypress.

I played around some more and found I could also edit the cyNavi string and append it at the start of the cyStart string to achieve the same result.

This was a fun exercise. Took a little while, but I figured it out. Now I can start cypress on a whim before you can say Robert is your father’s brother, and Bethany is your mother’s sister…or so I thought

Turns out this opens Cypress, but it doesn’t include any of my scripts! It appears to open to some default setting where I only see sample scripts that came with the installation. In order to access my files, I have to start Cypress from the installation directory. Additionally, Cypress lets users add a script to start it using the Node Package Manager.

To remedy this, I wrote a script that changes to the installation directory and invokes the open command to run Cypress.

The script is convenient because it can run from any directory and it opens Cypress with my project files intact.

Related

Moving Forward
Not This Exit Again! 10/100 Days of Code
Richard Clarke
Richard is currently a developer using Java and Android Studio to build custom applications for Android. Richard tutored in mathematics at Montgomery College, and worked in Information Technology before entering the Software Development industry as a Quality Engineer.
100daysofcode Bash Cypress javascript js node Script Scripting

Related articles

Your New Favorite Stopwatch App!…
Two for Two BABY! 7…
…But the App is for…
Play Store Blues – 5…
Top 4 Tips for Android…
No Dice – 3 of…

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Join the mailing list!

This field is required.

Check your inbox or spam folder to confirm your subscription.

Follow me on social media!

  • GitHub
  • YouTube
  • X
  • Instagram
  • LinkedIn
My Tweets

Join the mailing list!

This field is required.

Check your inbox or spam folder to confirm your subscription.

Follow me on social media!

  • X
  • GitHub
  • LinkedIn
  • YouTube

Archives

Theme by Colorlib Powered by WordPress