bunch of questions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting bunch of questions
# 1  
Old 06-30-2008
Question bunch of questions

hi guys :>

after reading several beginner tutorials and howtos i got still some questions concerning a script, i'm working on atm. Smilie

Is it possible to check if a mounted cd (cdrw) is readable and/or writable (clean disk)?

Is it possible to open a new window which displays the output of the script (echo "bla etc")? it should pops up after clicking the executed script.

best regards Smilie
# 2  
Old 06-30-2008
If your CD is mounted at, for example, /mnt/cd, then you can use some file test operators in bash to check whether you have read or write permissions, e.g.
Code:
if [ -r /mnt/cd ]; then
...
fi
if [ -w /mnt/cd ]; then
...
fi

For opening a new window, you could try
Code:
xterm -e 'echo "bla etc"'

Note that the xterm window will exit when the last command run in it exits. So you should add more stuff to make it persist for longer. Depends on what you want the window to do.
# 3  
Old 06-30-2008
yeah, that's cool Smilie
thanks for your comment

is it possible to close the xterm after x seconds?
# 4  
Old 06-30-2008
xterm -name mytest..... &

# Put process into background

PID=`ps -ef|grep xterm|grep mystest|sed /grep/d|awk '{print $2}'`

# Get the process ID

sleep 5

# Sleep for 5 seconds

kill $PID

# Kill it

When getting the PID you need to make sure that it is the Xterm you started hence the mytest in my example.
# 5  
Old 06-30-2008
Quote:
is it possible to close the xterm after x seconds?
I would sleep in the xterm itself, i.e.
Code:
xterm -e 'echo "bla etc"; sleep 5'

# 6  
Old 06-30-2008
yeah, it's working! you guys are great. thanks a lot for your helpfulness
# 7  
Old 07-01-2008
Quote:
Originally Posted by spirtle
I would sleep in the xterm itself, i.e.
Code:
xterm -e 'echo "bla etc"; sleep 5'

Yep that is definitely easier doh!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to rename bunch of files on sftp?

Hi All, I am trying to move all processed .csv files on sftp to archive dir . I tried to use wildcard *.csv but its not working . Is there any way to do this. I appreciate your help. Regards, raj (1 Reply)
Discussion started by: rajeevm
1 Replies

2. Shell Programming and Scripting

Remove the first two records from a bunch of files

Hi, i have lots of single-column text files in a directory and i want to remove from each of them the first two lines and print the result in multiple new single-column files. i know that for one file the below tail command would just do the job : tail -n +3 filename > new_filename is there... (4 Replies)
Discussion started by: amarn
4 Replies

3. Shell Programming and Scripting

Removing a bunch of lines

I have a file that contains the following multiple times: 0<< bla bla bla bla bla bla exit; Can somebody give me a sed or AWK command I can use to remove all occurances from this file. I would like it to find 0<< (note the zero may be proceeded by spaces) and remove that line and... (3 Replies)
Discussion started by: BeefStu
3 Replies

4. Shell Programming and Scripting

bunch of ^@^@^@^@^@^@^@^@'s in bash log file

I have a bash script that has been running fine for months that scans a bunch of files and gives me a log file output, it has suddenly started putting 1.5M of a repeating sequence of ^@^@^@^@^@^@^@^@^@^@ on the first line of the logfile, is this a unicode problem I should be setting something in my... (5 Replies)
Discussion started by: unclecameron
5 Replies

5. Shell Programming and Scripting

Renaming a bunch of files

This is possibly a FAQ, but I was unable to find an answer: let's say you have two files named "hello.txt" and "goodbye.txt" and you want them to be "hi.txt" and "seeyou.txt". The typical regular expressions renamer apps do not apply, as you want different new names for each one of the files. The... (2 Replies)
Discussion started by: tokland
2 Replies

6. UNIX for Dummies Questions & Answers

How do I rename a bunch of files at once?

I have about 3000+ files name P08DDD that I want to rename U08DDD. How can I do this using a single command? (8 Replies)
Discussion started by: bbbngowc
8 Replies

7. UNIX for Dummies Questions & Answers

Bunch of questions...

1. If Shell is something that handles the commands, what is the Operating System them? What does that do actually? Bridge the Shell and the Hardware or Instruction Set together? 2. One of the commands that I'm curious about is the "which" command. I want to know what is exactly written inside... (3 Replies)
Discussion started by: Legend986
3 Replies

8. Windows & DOS: Issues & Discussions

batch file--bunch of commands

I have a batch file that takes 2 parameters--source file location and target file location. I want to create another batch file that contains all the commands with the file locations so that I dont have to enter the ifnromation every time individually. For eg: to execute command com1.bat... (3 Replies)
Discussion started by: alfredo123
3 Replies

9. Shell Programming and Scripting

Renaming a bunch of files

Hi Can any body help me reg. this problem? The problem is the format of the shell script should be >renam old new rename: it renames all files in current directory from old extension to new extension old: it is the old extension of file name (including the '.' ) new: its the new extension ... (2 Replies)
Discussion started by: Prashanth.m
2 Replies

10. News, Links, Events and Announcements

what a bunch of idiots...

http://slashdot.org/article.pl?sid=04/01/15/2349201&mode=thread&tid=126&tid=155&tid=95&tid=99 (1 Reply)
Discussion started by: norsk hedensk
1 Replies
Login or Register to Ask a Question