Sponsored Content
Top Forums Shell Programming and Scripting Problem wth spec chars in script Post 303002238 by elxa1 on Sunday 20th of August 2017 04:36:50 PM
Old 08-20-2017
Problem wth spec chars in script

Hello

I would like to make a script which will get the line from file list (ex. passkey) and put it into further processing.
The main problem is that lines, in text file contains all specials characters, and whitespaces too, as these that was used as a extremmaly-safe passwords. I have written my passwords to .7z files on long list, but I can't find which one is propper for specific .7z file. So i am expecting "password" string and getting it line-by-line from passkey list and later each line into next 7z spawns.

Unfortunately bash stopping the run when first special character occurs on the list, and script trying to load it, going to problem


So I have created two scripts:
which I am calling ~/whiler /path/file.7z

1. 'whiler'
Code:
 1 while read line ; do
 2 echo "$line"
 3 time  expect ~/2.exp $1 "$line"
 4
 5 done<~/passkey.txt

2. and the expect cmdfile:
Code:
  1 #!/usr/bin/expect
 2 set filename [lindex $argv 1]; # Grab the first command line parameter
 3 set passkey [lindex $argv 2]; # Grab the 2nd command line parameter
 4 set timeout 1
 5 spawn 7z t $filename
 6 expect "password:"
 7 send "$klucz\r";
 8 interact

I also tried to make password list in doublequotes (") each line.

What can I do to use strings from file bypassing the injection bash ? Or maybe my scripts are bad?

Thanks for any help
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to convert C source from 8bit chars to 16bit chars?

I was using the following bash command inside the emacs compile command to search C++ source code: grep -inr --include='*.h' --include='*.cpp' '"' * | sed "/include/d" | sed "/_T/d" | sed '/^ *\/\//d' | sed '/extern/d' Emacs will then position me in the correct file and at the correct line... (0 Replies)
Discussion started by: siegfried
0 Replies

2. UNIX for Advanced & Expert Users

Problem in FTP of file with chinese chars

Hi, I have a file in my PC with Chinese (PRC) characters. When I transfer that file into my AIX5.3 server through FTP, I get junk characters instead of Chinese chars. Last week I copied the content from my notepad and pasted in vi editor. The Chinese characters were correct, but when I try now,... (4 Replies)
Discussion started by: carthyc
4 Replies

3. Shell Programming and Scripting

find 4 chars on 2nd line, 44 chars over

I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :( I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies

4. Shell Programming and Scripting

wth...can't read my post

something is wrong, I can read every post except mine. Very weird, and extremely anoying I can see replies to my post but can't view them, instead it keeps trying to save the page and open it from downloads... but the downloaded page can't be viewed. Don't suppose someone can copy/paste the thread... (0 Replies)
Discussion started by: gcampton
0 Replies

5. Shell Programming and Scripting

Help wth Net::FTP in script sometimes fails but wsftp always works

Hi, I have a script that transfers files from a Solaris server to target unix servers. The script uses Net::FTP->put to write the files, which can be any number of files, not always the same. This script works flawlessly to many servers. For one particular instance of the script,... (3 Replies)
Discussion started by: csgonan
3 Replies

6. Shell Programming and Scripting

Calling script from a RPM spec file

Hi, I want to execute a script "myscript.sh" in the %post part of a rpm spec file. Suppose the script is placed in /opt/path. Then simply calling like sh /opt/path/myscript.sh from %post part (of that spec file) will suffice? Or there is any other way? (0 Replies)
Discussion started by: saurabhkoar
0 Replies

7. UNIX for Dummies Questions & Answers

Problem with replacing chars in file

my file is : hello1 hello2 hello3_B,dummy,N Need to change to : hello1 hello2 hello3_B,dummy_01,N Can anyone help? Thank you. Please use code tags next time for your code and data. (6 Replies)
Discussion started by: Alyssa
6 Replies

8. UNIX for Advanced & Expert Users

Script monitor website wth default tomcat script

Hi all, on our application server we have the following script that monitor the status of the website, my problem here is that i have edite the retries from 3 to 5, and the timewait to 120 second, so the script should check 5 times every 2 minutes, and if the fifth check fails it must restart... (0 Replies)
Discussion started by: charli1
0 Replies

9. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies
jrunscript(1)						      General Commands Manual						     jrunscript(1)

NAME
jrunscript - command line script shell SYNOPSIS
jrunscript [ options ] [ arguments... ] PARAMETERS
options Options, if used, should follow immediately after the command name. arguments Arguments, if used, should follow immediately after options or command name. DESCRIPTION
jrunscript is a command line script shell. jrunscript supports both an interactive (read-eval-print) mode and a batch (-f option) mode of script execution. This is a scripting language independent shell. By default, JavaScript is the language used, but the -l option can be used to specify a different language. Through Java to scripting language communication, jrunscript supports "exploratory programming" style. NOTE: This tool is experimental and may not be available in future versions of the JDK. OPTIONS
-classpath path Specify where to find the user's .class files that are accessed by the script. -cp path This is a synonym for -classpath path -Dname=value Set a Java system property. -Jflag Pass flag directly to the Java virtual machine on which jrunscript is run. -l language Use the specified scripting language. By default, JavaScript is used. Note that to use other scripting languages, you also need to spec- ify the corresponding script engine's jar file using -cp or -classpath option. -e script Evaluate the given script. This option can be used to run "one liner" scripts specified completely on the command line. -encoding encoding Specify the character encoding used while reading script files. -f script-file Evaluate the given script file (batch mode). -f - Read and evaluate a script from standard input (interactive mode). -help Output help message and exit. -? Output help message and exit. -q List all script engines available and exit. ARGUMENTS
If [arguments...] are present and if no -e or -f option is used, then the first argument is the script file and the rest of the arguments, if any, are passed as script arguments. If [arguments..] and -e or -f option are used, then all [arguments..] are passed as script argu- ments. If [arguments..], -e and -f are missing, interactive mode is used. Script arguments are available to a script in an engine variable named "arguments" of type String array. EXAMPLES
Executing inline scripts jrunscript -e "print('hello world')" jrunscript -e "cat('http://java.sun.com')" Use specified language and evaluate given script file jrunscript -l js -f test.js Interactive mode jrunscript js>print('hello world'); hello world js>34 + 55 89 js> thread(function() { print('hello world'); } hello world js> Run script file with script arguments jrunscript test.js arg1 arg2 arg3 test.js is script file to execute and arg1, arg2 and arg3 are passed to script as script arguments. Script can access these using "argu- ments" array. SEE ALSO
If JavaScript is used, then before evaluating any user defined script, jrunscript initializes certain built-in functions and objects. These JavaScript built-ins are documented in jsdocs. 06 Aug 2006 jrunscript(1)
All times are GMT -4. The time now is 06:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy