Search Results

Search: Posts Made By: Sniper Pixie
5,828
Posted By Sniper Pixie
Cheers! It's been a long long day. :(
Cheers! It's been a long long day. :(
5,828
Posted By Sniper Pixie
Doh! So I am. The question still stands though - ...
Doh! So I am. The question still stands though -

test -w . ; echo ?

just returns "?" now
5,828
Posted By Sniper Pixie
determine owner directory permissions from within the directory
From within a directory, how do I determine whether I have write permission for it.

test -w pwd ; echo ?

This doesn't work as it returns false, even though I have write permission.
100,365
Posted By Sniper Pixie
I'm afraid neither of those two solutions work....
I'm afraid neither of those two solutions work. Both still print the error message, with the added bonus of yours producing a question mark as well, Vino.
100,365
Posted By Sniper Pixie
That doesn't work. It still outputs that -j is an...
That doesn't work. It still outputs that -j is an invalid option
100,365
Posted By Sniper Pixie
redirect stderr to dev/null in bash env.
Working in a bash environment, in the following example, how do I direct the error message that putting in an invalid flag (-j for example) would normally produce to dev/null?

while getopts "abcd"...
7,817
Posted By Sniper Pixie
Thanks for your help Ygor. That's neater than the...
Thanks for your help Ygor. That's neater than the alternative I came up with.
7,817
Posted By Sniper Pixie
extract from string variable into new variables
I have a variable which consists of a string like this:

001 aaabc 44 a bbb12

How do I extract each substring, delimited by the spaces, into new variables - one for each substring?

eg var1...
2,879
Posted By Sniper Pixie
Writing to variables within a loop
I have a loop which will go round "i" number of times and return a value each time. Is there a way to set a variable(i) such that I will end up with variable(1), variable(2), variable(3) etc. for...
13,700
Posted By Sniper Pixie
Thanks gauravgoel, that was just what I was...
Thanks gauravgoel, that was just what I was looking for. Thanks for your effort as well, vino.
13,700
Posted By Sniper Pixie
Thanks for your reply, but I want it to loop...
Thanks for your reply, but I want it to loop through the string and then perform an action for each occurrance of r, not just once. eg. "rover" would return 11 in this example because there're two...
13,700
Posted By Sniper Pixie
if statement in for loop of a string
I am attempting to pass a string into awk and loop through it, and then for every occurrance of a certain character perform an action. In this case, for example, echo 1 for each time character r is...
7,734
Posted By Sniper Pixie
Thanks Ygor. That was exactly what I was looking...
Thanks Ygor. That was exactly what I was looking for. I only spent about 8 hours trying to figure it out yesterday! :confused:
7,734
Posted By Sniper Pixie
Right. I'm in a bash shell. Any ideas about how I...
Right. I'm in a bash shell. Any ideas about how I go about it in that?
7,734
Posted By Sniper Pixie
Okay, I've been playing around with the command...
Okay, I've been playing around with the command you gave me, matrixmadhan, but I can't figure out how to print the fields $1, $2, $3 etc to different variables. They always either end up in the first...
7,734
Posted By Sniper Pixie
Excellent. Thanks a lot!
Excellent. Thanks a lot!
7,734
Posted By Sniper Pixie
extracting return of ls -l into variables
If I do "ls -l filename" in a script, it should return something like this:

-rw-r--r-- 1 user group 5945 Feb 28 14:24 filename

How do I put each of the above strings into a different...
3,850
Posted By Sniper Pixie
I'm a complete newbie at UNIX. I have an exercise...
I'm a complete newbie at UNIX. I have an exercise to do where I have to find the username of someone executing a script and print it to another file. I was sort of hoping for a command like finger,...
3,850
Posted By Sniper Pixie
Thanks for your reply. Now all I have to do is...
Thanks for your reply. Now all I have to do is figure out how to use getlogin()

:confused:
3,850
Posted By Sniper Pixie
How to find who is executing a file.
Suppose there is a file which is being executed by someone. Is there a way to return the username of whoever is using that file?
5,338
Posted By Sniper Pixie
Yep, that works a treat. Thanks a lot tmarikle.
Yep, that works a treat. Thanks a lot tmarikle.
5,338
Posted By Sniper Pixie
file1 is four lines "line 1, line 2, line 4, line...
file1 is four lines "line 1, line 2, line 4, line 5"

I want to introduce a new line.

For example, this works:

sed '/2/a\
line 3' file1

This doesn't

variable=2
sed "/\$variable/a\...
5,338
Posted By Sniper Pixie
Nope, still no result.
Nope, still no result.
5,338
Posted By Sniper Pixie
Afraid not; it gives me this error message if I...
Afraid not; it gives me this error message if I replace ' with "

sed: -e expression #1, char 10: Extra characters after command
5,338
Posted By Sniper Pixie
$Variable address in sed
I'm attempting to append a line after a specific address with sed. If I type in the address eg.3 then it will append after the third line. I can't get it to work with a variable though. Does anyone...
Showing results 1 to 25 of 25

 
All times are GMT -4. The time now is 07:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy