Search Results

Search: Posts Made By: guitarscn
34,416
Posted By guitarscn
This would require at least 3 arguments though,...
This would require at least 3 arguments though, correct? Because if you only provided 2, the script wouldn't know which 2 arguments they are for and most likely use the first two options. Right? Or...
34,416
Posted By guitarscn
@bartus11 Would it be safer to put double...
@bartus11
Would it be safer to put double quotes around the $4?:

...
if [ -z "$4" ]; then
...


@jlliagre
What exactly does "${4:+-d $4}" mean? Can this be applied to the other arguments...
34,416
Posted By guitarscn
How to make shell script arguments optional?
Here is my script:


#!/bin/ksh

usage ()
{
echo " Usage: $0 <opt1> <opt2> <opt3> <opt4>"
}

if [ $# -lt 3 ]; then
usage
exit;
fi

prog -a $1 -b $2 -c $3 -d $4...
1,771
Posted By guitarscn
How do I run a shell command in a while loop?
The command is:

sic -h irc.freenode.net 2>&1 | tee -a irc.log

Where sic is an IRC client, and I'm piping the output to tee in order to log my IRC sessions.

I'm trying to handle reconnects by...
11,403
Posted By guitarscn
set: no tw option: 'set all' gives all option...
set: no tw option: 'set all' gives all option values.

I've tried this already and found out it was for vim, not vi :(

":%!fold -w80" works, but it cuts off words. I don't want it to cut off...
11,403
Posted By guitarscn
How to wrap words in vi?
I just typed several long lines into vi but I only want it to have 80 columns. How can I set this in vi?
6,777
Posted By guitarscn
I do not know if my system uses MD5 for password...
I do not know if my system uses MD5 for password hashes - the MD5 hash I am testing is just a hash generated by a PHP script I think - I just Googled 'MD5 encrypter' and used one of the links there...
6,777
Posted By guitarscn
How to convert MD5 hash into shadow format?
I am trying to use John the Ripper but it doesn't take regular MD5 hashes, only shadow MD5 hashes. For example this hash: 900150983cd24fb0d6963f7d28e17f72 (which, decrypted, is 'abc') within a text...
20,291
Posted By guitarscn
ksh syntax error: `(' unexpected
So I am trying to convert my bash script into ksh, and this is what I have in the file so far:


#!/bin/ksh

login()
{
if [ "$ALPHA" = "" ]
then
sendcmd BETA
else
sendcmd...
13,172
Posted By guitarscn
How to append text to the second line of a file
Say I have a text file like:


1
3
4


How would I use ksh to put the number '2' into the second line of that file? I'm using OpenBSD so the sed syntax might be a bit different (I have no...
1,928
Posted By guitarscn
How to make delays between multiple commands in an alias (ircII)?
Okay so I have an alias that looks like this:


ALIAS gscn {
MSG gscn Test1
MSG gscn Test2
MSG gscn Test3
MSG gscn Test4
MSG gscn Test5
}


How do I make it wait 5 seconds between each...
3,790
Posted By guitarscn
My domain name as my IRC hostname?
When I connect to any IRC server, it's usually my ISP IP address/hostname. I own a domain, but I'm not using it for anything (no web hosting service or server). Is it possible for me to use my domain...
Forum: IP Networking 08-31-2010
2,873
Posted By guitarscn
If 'host' returns not found...
$ host 80.159.xx.xxx
Host 222.79.xxx.xxx.in-addr.arpa not found: 3(NXDOMAIN)

What does this mean? The person currently using the IP address in IRC is chatting right now, but how come if he's...
3,151
Posted By guitarscn
nvm I got it...I forgot $1 was already being used...
nvm I got it...I forgot $1 was already being used so I just changed the WORD2's argument to $2
3,151
Posted By guitarscn
Okay, I tried this: #!/bin/bash ...
Okay, I tried this:

#!/bin/bash
#ascript.sh

WORD1=$1
WORD2=$2
echo "arg1 -> $arg1"
echo "arg2 -> $arg2"

WORD1=`tail -n +$1 /home/gscn/word1.txt | head -1`
sed -e "s/WORD1/$WORD1/g" <...
3,151
Posted By guitarscn
How to make 2 separate arguments in 1 bash script?
This is what I have:


#!/bin/bash
#ascript.sh

WORD1=`tail -n +$1 /home/gscn/word1.txt | head -1`
sed -e "s/WORD1/$WORD1/g" < /home/gscn/configtmp > /home/gscn/config

WORD2=`tail -n +$1...
3,101
Posted By guitarscn
'w' and 'who' are very similar, they have the...
'w' and 'who' are very similar, they have the same information just switched around a bit

'users' just list the usernames only
3,101
Posted By guitarscn
I am on FreeBSD so -w is not an option for who,...
I am on FreeBSD so -w is not an option for who, but with 'who -TH' the hostname still gets cut off at the end
3,101
Posted By guitarscn
"pool-92-199-17-1" is not my full hostname (it...
"pool-92-199-17-1" is not my full hostname (it has a couple more numbers). I want it to display the full thing
3,101
Posted By guitarscn
How to expand who command?
When I do the who command it doesn't show all my info:


$w gscn
6:08PM up 4 days, 20:33, 177 users, load averages: 7.46, 3.78, 3.43
USER TTY FROM LOGIN@ IDLE...
2,546
Posted By guitarscn
Okay, I decided to make it a bit simpler, and...
Okay, I decided to make it a bit simpler, and with bash scripting it seems shorter. I have this so far:


#!/bin/bash
killall process1
#editing configs
process1 &
sleep 5
process2


The...
1,376
Posted By guitarscn
Thanks, I looked up shell redirection and...
Thanks, I looked up shell redirection and understand it now
1,376
Posted By guitarscn
Question about why a command does this
$ echo 2 * 3 > 5 is a valid inequality.
This will create a file in the current directory named '5' with the number '2' in it, the names of all the files in the current directory, followed by the...
2,546
Posted By guitarscn
Simple script editing text files and running commands
Okay this will probably have multiple parts to it but I don't really want to trouble you guys with more help because I'm a total noob so I can just do the first part by hand (it's just editing a few...
8,507
Posted By guitarscn
Deleting all instances of a certain character from a text file
In my command prompt I did:
sed 's/\://' mytextfile > newtextfile
But it only deleted the first instance of : in each line when some lines have multiple : appearing in each one. How can I delete...
Showing results 1 to 25 of 45

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