Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how i appear a script?  RSS feed

 
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i create a script .I have a text inside i return to the shell ,but how can i appear it this ?
 
Marshal
Posts: 58395
178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. Please show us how far you have got with the script.
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Don't know. Please show us how far you have got with the script.

inside the script i have this .Script name is file1.I create it with vi file1 and on the script text is this:
#!/bin/sh

#filename

#---

echo "1.the process id is : $$ and cwd $PWD"

echo '2.the process id is : $$ and cwd $PWD '

echo 3.the process id is : $$ and cwd $PWD


after this i exit escape after i write this :qw! and i press enter .After what to do to appear it ?
 
author
Marshal
Posts: 23438
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ekte spiriopoulos wrote:After what to do to appear it ?



Can you explain what you mean by "appear it"? Do you mean to run the shellscript?

Henry
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Henry Wong wrote:

ekte spiriopoulos wrote:After what to do to appear it ?



Can you explain what you mean by "appear it"? Do you mean to run the shellscript?

Henry

exactly
 
Saloon Keeper
Posts: 19269
85
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Find someone with a better command of the English language to help you re-phrase the question.

We don't understand what "to appear it" means.
 
Henry Wong
author
Marshal
Posts: 23438
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

First, your shellscript needs to be executable. Is it executable? If not, you can use the "chmod" command to make it so.

And once it is executable, you can run it, just like any other executable.

Henry
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Henry Wong wrote:
First, your shellscript needs to be executable. Is it executable? If not, you can use the "chmod" command to make it so.

And once it is executable, you can run it, just like any other executable.

Henry

it is but i dont know how ...with what command
 
Marshal
Posts: 5593
384
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ekte wrote:it is but i dont know how ...with what command


./scriptname.sh

after you do what Henry instructed you.
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:

ekte wrote:it is but i dont know how ...with what command


./scriptname.sh

after you do what Henry instructed you.

thanks
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:

ekte wrote:it is but i dont know how ...with what command


./scriptname.sh

after you do what Henry instructed you.

it didnt worked.I read again theory and i did sh file1 and it worked fine.Anyway thanks for your help
 
Liutauras Vilda
Marshal
Posts: 5593
384
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome

What Henry mentioned you can do in this way:
and then
In case you don't want that, you can simply execute in one of those ways:
or

In Linux distributions default shell is bash (same as in Mac OS X), so run 1st line. FreeBSD default installation uses tcsh, so bash command wouldn't work, so you'd need to use sh interpreter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!