some questions...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting some questions...
# 1  
Old 01-05-2004
some questions...

hello. I'm fairly new to unix and have a few script writing questions for any experienced users. However, my computer is a mac so I need commands that will run in a macosx terminal.
ok:
q1) im writing a script where I want to get the history in the terminal and then write it to a specific text file. I'm not sure how to do it. I tried:
history | touch /dir/dir/dir/etc/filename

can anyone tell me why it didnt work/what would be the right command/commands.

q2)Im writing another script and I want the terminal to prompt the user for their password. I dont know how to collect user input or prompt them. Is it possible? All i can do is: echo 'password:'

but thats not an input prompt and the [ownername] command ready thing is just gonna pop back up once the script is done executing and they wont enter a password near my input prompt. how do i actually make a input/prompt thing?

q3)i have yet another script (lets call it script.sh). I want script.sh to execute when a user clicks on it rahter than them having to execute it with the ./ command in the terminal. How?


Well those are my questions. Hopefully someone can answer them. Thanks alot.
# 2  
Old 01-05-2004
For 3), you may put your script in /usr/local/bin. Then, if /usr/local/bin is in your PATH, then you can invoke it without ./
# 3  
Old 01-05-2004
Ok, but I want the script to open from the desktop just by double clicking it. Is there a way to have a script execute from anywhere by just double clicking the file?How can I do that instead of putting it off in the usr/local/bin folder?
# 4  
Old 01-05-2004
Sorry I misread that. Then that's an issue with your GUI used. I use KDE, but I believe GNOME also has a similar function that lets you create a "shortcut" on the desktop just as you do on Windows. Just right click on your desktop and you ought to find an option like create a new link.
# 5  
Old 01-05-2004
I think I may be doing something wrong, but I tried what you suggested. I control-clicked(i have a mac, no right clicks) on the desktop and it brought up the options: Help, New Folder, Get info, and Change Desktop Background. Then I control-clicked on the file i want to execute in the terminal via the desktop(test.sh) and it brought up the options: Help, Open, Open With, Get Info, Move To Trash, Make Alias, Duplicate, and Copy "Test.sh". I tried to change Open With to open with the terminal but it wouldnt let me. I think I'm doing something wrong.
# 6  
Old 01-05-2004
I don't know your environment, but I'll make a few guesses based on what I know.

touch does not read stuff from standard in. So piping stuff to it does nothing. Try: history > /dir/file

And "echo -n prompt " might work. Or "echo 'prompt \c'.
# 7  
Old 01-06-2004
I guess you use GNOME. I don't know mac, but you ought to find a "New Launcher" menu item which allows you to create a shortcut, in M$ terminology.

http://www.gnome.org/learn/users-gui...eskback-9.html
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Vi questions

Hello, I would like to know how we can highlight/select a section of a file in vi and delete that section if we don't want to use the dd command to delete one line at at time. There is one where we don't want to delete the whole line , but up to a certain word. (2 Replies)
Discussion started by: Pouchie1
2 Replies

2. UNIX for Dummies Questions & Answers

Just had a few questions

1) The lpr and sort utilities accept input either from a file named on the command line or from standard input. a)Name two other utilities that function in a similar manner. b)Name a utility that accepts its input only from standard input. 2) Explain the following error message. What... (10 Replies)
Discussion started by: youngyou
10 Replies

3. Homework & Coursework Questions

Print questions from a questions folder in a sequential order

1.) I am to write scripts that will be phasetest folder in the home directory. 2.) The folder should have a set-up,phase and display files I have written a small script which i used to check for the existing users and their password. What I need help with: I have a set of questions in a... (19 Replies)
Discussion started by: moraks007
19 Replies

4. Programming

two questions

hey all, I have question when am writing simple shell... in the child am calling execvp, i want the parent to know when execvp returns - 1. how can i let the parent know the result of execvp thanks in advance (9 Replies)
Discussion started by: joey
9 Replies

5. UNIX for Dummies Questions & Answers

Just a few questions.

Hi everyone im new to this forums, i just wanted to get started by asking a few question(Im a Unix newbie) 1. How do i sort a file called "dirr" in a ascending order on the 3rd column 2. what does alias on=who do Thanks in advance!!! (1 Reply)
Discussion started by: Da Paper
1 Replies

6. Solaris

2 Questions

Hello Everbody I hope you can give me a hand, I have some questions The first one itīs about some message that I donīt know what means, I was looking about it. but nothing. This is the message rsh: connection from bad port bsd-gw: Error reading from connection: Bad file number And my... (4 Replies)
Discussion started by: lo-lp-kl
4 Replies

7. Programming

C questions

What does "extern" do? ex. extern int x; and another question, what about using static in functions? like: static void foo(), why? (2 Replies)
Discussion started by: Esaia
2 Replies

8. UNIX for Dummies Questions & Answers

i got some questions :)

Hi! Im new to all this but the computer club im in has unix i think. now my questions. 1.is it NTFS i need to partion the harddrive with to be able to use unix? 2.Unix and Linux whats the diffrense?yes im a noob got no idea been using crap windows for ages and hate it. 3.I got a win98... (2 Replies)
Discussion started by: Pierre
2 Replies
Login or Register to Ask a Question