Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

script not working

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my entire script below. essentially, I want a user to CD into the directory if he is prompted for, and also, rerun the script when it asks at the end. Everything works great except the end. if you see at the end when asking for cd into directory and asking if you would like to rerun the script, i just have it executing it again. Should I store it in a variable and call it? instead of just have ./search.sh
the error is it saying for cd into the directory, just blank. I know there is a child application, but I am not understanding the concept of it.
and to rerun the script, it is just saying cant fin it




 
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would probably have a loop rather than recursively calling the script. However, I don't see why that wouldn't work. I notice a couple of things though. First you call the script search.sh in your comments, but in the code, you're calling test.sh. Typo? Also, if the user chooses to cd into the directory, that's it. There's no recursive call in that case, and the script just ends. After the script, the current directory goes back to what it was before the script ran, so making a cd the last thing in a script doesn't have any effect.
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic