Sponsored Content
Top Forums Shell Programming and Scripting Store Host lookup in variable ("on the fly") Post 302477243 by sOliver on Friday 3rd of December 2010 06:28:44 PM
Old 12-03-2010
Store Host lookup in variable ("on the fly")

Hi,

I'm new here. I was wondering why I can't store a host lookup in a variable.


Code:
for line in $(< blacklist)
do
STOREIP=host $line;
if [[ $storeip != *bot* ]]; then
$line >> blacklist2;
else
$line >> blacklist3;
fi
done

Result: "ip" command not found .. so how would I store the host lookup in the variable?

Basically I have IP's stored in a file and want to check them via rdns if they include the string "bot". If they dont I want to save them in blacklist2, if they do in blacklist3.

If anyone could help me out with this I'd be grateful... I'm pretty new to this and so far I really like how easy it is to write some useful scripts, but this is a bit too difficult for me.

Thanks a lot!
Oliver
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

How to store the output of "time dd if= of=" in a variable

Hi All, I need to store the real seconds of the following command in a variable. How could it be done? time $(dd if=/dev/zero of=/dev/sda1 bs=512 count=2048;sync) Thanks, Amio (12 Replies)
Discussion started by: amio
12 Replies

3. Shell Programming and Scripting

store the output of "find" command in a variable?

I intend to find the path/full location of a file(filename given by user thru "read filenme") using "find" or any other command and then store it's output in a variable for some other processing. But struggling to put all things together (i.e finding the fully qualified location of that file and... (4 Replies)
Discussion started by: punitpa
4 Replies

4. Shell Programming and Scripting

Unable to store "-e" in variable ??????

p="-e" echo $p It is not returning the value "-e" stored. Instead returns null. I am wondering how could this happen. Please help me out.I tried all possibilities like p='-e' | p="\-e". Nothing seems to work. :confused::confused: (10 Replies)
Discussion started by: shanneykar
10 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. UNIX for Advanced & Expert Users

How to gzip files "on fly" before copying

Hello, I want to gzip some files before copying to remote host. There is no freespace on source host so it needs to be perfomed within one-liner. I tried the following but it didn't work gzip -c -9 all_rvds.xml |ssh targethost "dd of=/tmp/all_rvds.xml.gz" cat all_rvds.xml |gzip -c9 |ssh... (5 Replies)
Discussion started by: urello
5 Replies

7. UNIX for Dummies Questions & Answers

What is the significance of sh -s in ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh?

Please can you help me understand the significance of providing arguments under sh -s in > ssh -qtt ${user}@${host} "sh -s "${version}"" < test.sh (4 Replies)
Discussion started by: Sree10
4 Replies

8. Shell Programming and Scripting

Unable to store "python --version" to a shell variable

Hi All, I need to get the version of python installed and store it in a variable for later use. Whereas it is printing on the console instead of storing to variable. I am able to store output of ls command in a variable. Please check the below code : root@myhost:/volumes/srini# cat... (4 Replies)
Discussion started by: srinivasan.neel
4 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
JSONBOT(1)							    jsb manual								JSONBOT(1)

NAME
jsb-udp - The JSONBOT udp program SYNOPSIS
JSONBOT is a remote event-driven framework for building bots that talk JSON to each other over XMPP. jsb-udp can send txt in a udp packet to the bot which in his/her turn sends it to a channel. DESCRIPTION
Sometimes you want to have the output of a program send to a channel or conference the bot is participating in, for example logfiles (if they dont accumulate too fast). JSONBOT provides a plugin that can do this with the use of UDP packets send to the bot. This program is the client part and can be used to send txt pipelined into it to a UDP port on the listening bot. This bot will then forward the txt to the channel provided with the -p, --printto option. USAGE
Usage: jsb-udp [options] Options: --version show program's version number and exit -h, --help show this help message and exit -p PATH, --printto=PATH channel/user to print to -c CONFIGNAME, --config=CONFIGNAME Specify a config file -s, --save save to config file DOCUMENTATION
See http://jsonbot.org for more documentation or http://jsonbot.googlecode.com SEE ALSO
jsb(1), jsb-backup(1), jsb-init(1), jsb-irc(1), jsb-xmpp(1), jsb-fleet(1), jsb-stop(1), jsonbot(1) AUTHOR
This manual page was written by Bart Thate <bthate@gmail.com>, for the Debian GNU/Linux system (but may be used by others). Debian GNU/Linux 22 Nov 2011 JSONBOT(1)
All times are GMT -4. The time now is 08:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy