Search Results

Search found 6758 results on 271 pages for 'shell exec'.

Page 69/271 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Solve code issue - string identity testing

    - by kovibb
    Please for help with shell script. I really dont understand where is problem. Where I write to the Input variable for example /home/Kovi/Deskop/netlist.exe I still get true answer but the extension "exe" is not "scs". I also try "==" but it didnt working. Please some advice. Thank you very much. echo -n "Insert Entire Path (with file name and it's extension) of Input Netlist > " read Input if [ "${Input##*.}"="scs" ]; then echo "Patch verification is succesful.; else echo "Patch verification is failed, script was aborted. File dont exist or is empty or unreadable or is not spectre netlist." error_exit; fi

    Read the article

  • Running ARM assembly code in Android

    - by Robert Joseph Dacunto
    I've been following the guide posted here, trying to get this Hello, World program to run on my Samsung Galaxy S3. It's rooted already, and I successfully pushed the "hello" file onto the sdcard. Now when I enter the shell as the superuser (# instead of $), and try to run the file, I get "cannot execute - permission denied". I used chmod 755 hello to see if that would fix it, still nothing. Is there something I'm missing? This is my first time fiddling around with Android, just got the phone, and wanted to see if I could get this to work. Very new to it all. Thanks!

    Read the article

  • VBscript and CMD writing into a text file

    - by Effected
    I am writing a script that executes and write everything to the file here is example, I stored the complete command in the variable 'Command' , Command = "ftp ftp.xyz.com 21 " & vbCRLF and then executing it in command prompt, shell.Run "%comspec% /c FTP " & Command & " > " & E:/abc.txt, 0, TRUE but when this program execute it won't write anything to the text file because this is an incomplete command, this command on execution prompt user to input username and password of FTP, how can i do this , that my programm automatically input username and password when prompt and then write everything to file ?

    Read the article

  • How to write a program that mimics Fiddler by using tcpdump or from scratch?

    - by ????
    When Fiddler is not on Mac OS X or Ubuntu, and if we don't install/use Wireshark or any other more heavy duty tools, what is a way to use tcpdump so that 1) It can print out GET /foo/bar HTTP/1.1 [request content in RAW text] [response content in RAW text] POST /foo/... HTTP/1.1 this should be able to be done by tcpdump or by using tcpdump in a short shell script or Ruby / Python / Perl script. 2) Actually, it can be neat if a script can output HTML, with GET /foo/bar HTTP/1.1 POST /foo/... HTTP/1.1 on the page, for any browser to display, and then when clicked on any of those lines, it will expand to show the RAW content like (1) above does. Click again and it will hide the details. The expansion UI can be done using jQuery or any JS library. The script may be short... possibly less than 20 lines? Does anybody know how to do it either for (1) or (2)?

    Read the article

  • how to make this "action-packed, random data" being echoed in a terminal?

    - by RiMMER
    OK, this isn't really a question to achieve anything practical, but still it is a serious question and I hope it will be taken seriously and mods won't punish me for this :) I'm sure majority of you have seen some good action movie, where CIA or FBI or hackers or any other "pc nerds" are "retrieving some information" and when they actually show their screens/monitors/desktops, there is a lot of random data being displayed and it's just so thrilling :D So, we're shooting a movie and I need to reconstruct such a scene. My OS is ubuntu 10.10. I think i've read somewhere on the internet once that shell can actually be recorded and then played back, but I'm not sure how it worked. If there's anyone who could come up with a solution, it would be so cool! Let's make this fun, shall we?

    Read the article

  • Enter a letter when prompted by another command

    - by kij
    Hi all, I'm trying to automate the installation and deployement of an application. To do it, i have a shell script with the following instructions: /usr/local/bin/amf install -u $1 -p $2 $localTarget where $1, $2 and $localTarget are options for the command named 'amf'. The problem is that the 'amf' command make severall instructions and ask the user to enter a letter during those instructions (to confirm the installation). At the moment, i can't bypass or modify the behaviour of the 'amf' command, so my question is: How can i catch this behaviour and/or automatically enter a letter in my script. This behaviour currently make my script not working, because the 'amf instal...' instruction is followed by another command to start my application. But as the install failed, the application can't start. Thanks in advance for your help. Best regards. Kij.

    Read the article

  • Copy one column over another in a delimited file

    - by user275455
    For instance, I needed to remove column 25 and replace it with a copy of column 22 in a simple csv file with no embedded delimiters. The best I could come up with was the awkward looking: awk -F, '{ for(x=1;x<25;x++){printf("%s,", $x)};printf("%s,",$22);for(x=26;x<59;x++){printf ("%s,", $x)};print $59}' I would expect something like cut -d, -f1-24,23,26-59 to work but cut doesn't seem to want to print the same column two times... Is there a more elegant way to do it using anything typicaly available in a linux shell environment?

    Read the article

  • "tail -f" alternate which doesn't scroll the terminal window

    - by Jagtesh Chadha
    I want to check a file at continuous intervals for contents which keep changing. "tail -f" doesn't suffice as the file doesn't grow in size. I could use a simple while loop in bash to the same effect: while [ 1 ]; do cat /proc/acpi/battery/BAT1/state ; sleep 10; done It works, although it has the unwanted effect of scrolling my terminal window. So now I'm wondering, is there a linux/shell command that would display the output of this file without scrolling the terminal?

    Read the article

  • Elegant way to search for UTF-8 files with BOM?

    - by vog
    For debugging purposes, I need to recursively search a directory for all files which start with a UTF-8 byte order mark (BOM). My current solution is a simple shell script: find -type f | while read file do if [ "`head -c 3 -- "$file"`" == $'\xef\xbb\xbf' ] then echo "found BOM in: $file" fi done Or, if you prefer short, unreadable one-liners: find -type f|while read file;do [ "`head -c3 -- "$file"`" == $'\xef\xbb\xbf' ] && echo "found BOM in: $file";done It doesn't work with filenames that contain a line break, but such files are not to be expected anyway. Is there any shorter or more elegant solution? Are there any interesting text editors or macros for text editors?

    Read the article

  • How to get the number of files in a folder as a variable?

    - by Jason
    Using bash, how can one get the number of files in a folder, excluding directories from a shell script without the interpreter complaining? With the help of a friend, I've tried $files=$(find ../ -maxdepth 1 -type f | sort -n) $num=$("ls -l" | "grep ^-" | "wc -l") which returns from the command line: ../1-prefix_blended_fused.jpg: No such file or directory ls -l : command not found grep ^-: command not found wc -l: command not found respectively. These commands work on the command line, but NOT with a bash script. Given a file filled with image files formatted like 1-pano.jpg, I want to grab all the images in the directory to get the largest numbered file to tack onto the next image being processed. Why the discrepancy?

    Read the article

  • Data in linux FIFO seems lost

    - by Utoah
    Hi, I have a bash script which wants to do some work in parallel, I did this by putting each job in an subshell which is run in the background. While the number of job running simultaneously should under some limit, I achieve this by first put some lines in a FIFO, then just before forking the subshell, the parent script is required to read a line from this FIFO. Only after it gets a line can it fork the subshell. Up to now, everything works fine. But when I tried to read a line from the FIFO in the subshell, it seems that only one subshell can get a line, even if there are apparently more lines in the FIFO. So I wonder why cannot other subshell(s) read a line even when there are more lines in the FIFO. My testing code looks something like this: #!/bin/sh fifo_path="/tmp/fy_u_test2.fifo" mkfifo $fifo_path #open fifo for r/w at fd 6 exec 6 $fifo_path process_num=5 #put $process_num lines in the FIFO for ((i=0; i<${process_num}; i++)); do echo "$i" done &6 delay_some(){ local index="$1" echo "This is what u can see. $index \n" sleep 20; } #In each iteration, try to read 2 lines from FIFO, one from this shell, #the other from the subshell for i in 1 2 do date /tmp/fy_date #If a line can be read from FIFO, run a subshell in bk, otherwise, block. read -u6 echo " $$ Read --- $REPLY --- from 6 \n" /tmp/fy_date { delay_some $i #Try to read a line from FIFO read -u6 echo " $$ This is in child # $i, read --- $REPLY --- from 6 \n" /tmp/fy_date } & done And the output file /tmp/fy_date has content of: Mon Apr 26 16:02:18 CST 2010 32561 Read --- 0 --- from 6 \n Mon Apr 26 16:02:18 CST 2010 32561 Read --- 1 --- from 6 \n 32561 This is in child # 1, read --- 2 --- from 6 \n

    Read the article

  • Safe way to set computed environment variables

    - by sfink
    I have a bash script that I am modifying to accept key=value pairs from stdin. (It is spawned by xinetd.) How can I safely convert those key=value pairs into environment variables for subprocesses? I plan to only allow keys that begin with a predefined prefix "CMK_", to avoid IFS or any other "dangerous" variable getting set. But the simplistic approach function import () { local IFS="=" while read key val; do case "$key" in CMK_*) eval "$key=$val";; esac done } is horribly insecure because $val could contain all sorts of nasty stuff. This seems like it would work: shopt -s extglob function import () { NORMAL_IFS="$IFS" local IFS="=" while read key val; do case "$key" in CMK_*([a-zA-Z_]) ) IFS="$NORMAL_IFS" eval $key='$val' IFS="=" ;; esac done } but (1) it uses the funky extglob thing that I've never used before, and (2) it's complicated enough that I can't be comfortable that it's secure. My goal, to be specific, is to allow key=value settings to pass through the bash script into the environment of called processes. It is up to the subprocesses to deal with potentially hostile values getting set. I am modifying someone else's script, so I don't want to just convert it to Perl and be done with it. I would also rather not change it around to invoke the subprocesses differently, something like #!/bin/sh ...start of script... perl -nle '($k,$v)=split(/=/,$_,2); $ENV{$k}=$v if $k =~ /^CMK_/; END { exec("subprocess") }' ...end of script...

    Read the article

  • start-stop-daemon quoted arguments misinterpreted

    - by Martin Westin
    Hi, I have been trying to make an init script using start-stop-daemon. I am stuck on the arguments to the daemon. I want to keep these in a variable at the top of the script but I can't get the quotations to filter down correctly. I'll use ls here so we don't have to look at binaries and arguments that most people wont know or care about. The end result I am looking for is for start-stop... to run ls -la "/folder with space/" DAEMON=/usr/bin/ls DAEMON_OPTS='-la "/folder with space/"' start-stop-daemon --start --make-pidfile --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS Double escaping the options and trying innumerable variations of quotations do not help... Then they end up at the daemon they are always messed up. Enclosing $DAEMON_OPTS in quotes changes things... then they are seen as one since quote... never the right number though :) Echoing the command-line (start-stop...) prints exactly the right stuff to screen. But the daemon (the real one, not ls) complains about the wrong number of arguments. How do I specify a variable so that quotes inside it are brought along to the daemon correctly? Thanks, Martin

    Read the article

  • Problem with configure script

    - by cube
    I am running into a problem with the ./configure script for ffmpeg. My linux environment uses busybox, which only allows for limited set of linux commands. One command which is used in the ffmpeg ./configure script is mktemp -u, the problem here is the busybox for linux does not recognize the -u switch as valid, so it complains about it and breaks the configure process. This is the relevant code in ./configure which uses the mktemp -u command: if ! check_cmd type mktemp; then # simple replacement for missing mktemp # NOT SAFE FOR GENERAL USE mktemp(){ echo "${2%XXX*}.${HOSTNAME}.${UID}.$$" } fi tmpfile(){ tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 && (set -C; exec > $tmp) 2>/dev/null || die "Unable to create temporary file in $TMPDIR." append TMPFILES $tmp eval $1=$tmp } I am not good with bash scripting at all, so I was wondering if anyone one had an idea on how I can force this configure script to not use mktemp -u and use the 'replacement' alternative option that is available in as per the snippet above. Thanks. btw... simply removing the -u switch does not work. Nor does replacing it with -t, or -p. I believe the mktemp has to be bypassed completely.

    Read the article

  • windows shell scripting through java

    - by GAURAV JAISWAL
    i am designing a desktop application like nero for removable media storage that also includes features of copyfast. i want to add an option of my own choice in the windows explorer right click menu. how can i do that? am i proceeding in the right direction?

    Read the article

  • Unix shell script with Iseries command

    - by user293058
    I am trying to ftp a file from unix to as400 and executing iseries command in the script. ftp is working fine,I am getting an error in jobd command as HOST=KCBNSXDD.svr.us.bank.net USER=test PASS=1234 #This is the password for the FTP user. ftp -env $HOST << EOF # Call 2. Here the login credentials are supplied by calling the variables. user $USER $PASS # Call 3. Here you will change to the directory where you want to put or get cd "\$QARCVBEN" # Call4. Here you will tell FTP to put or get the file. #Ebcdic #Mode b quote site crtccsid *user quote site crtccsid *sysval put prod.txt quote rcmd sbmjob cmd(call pgm(pmtiprcc0) parm('prod' 'DEV')) job(\$pmtiprcc) jobd(orderbatch) 550-Error occurred on command SBMJOB cmd(call pgm(pmtiprcc0)) job($pmtiprcc) jobd(orderbatch). 550 Errors occurred on SBMJOB command.. 221 QUIT subcommand received.

    Read the article

  • Running Command via Java ProccesBuilder Different to Running the same in the Shell

    - by Tom Duckering
    I'm tearing my hair out trying to work out why the command I'm executing via Java using a ProcessBuilder & Process is not working. I run the "same" command at the Windows command line and it works as expected. It must be that they're not the same but I can't for the life of me work out why. The command is this: ccm start -nogui -m -q -n ccm_admin -r developer -d /path/to/db/databasename -s http://hostname:8400 -pw Passw0rd789$ The output is should be a single line string that I need to grab and set as an environment variable (hence the v. basic use of the BufferedReader). My Java code, which when it runs the command gets an application error, looks like this with entry point being startCCMAndGetCCMAddress(): private static String ccmAddress = ""; private static final String DATABASE_PATH = "/path/to/db/databasename"; private static final String SYNERGY_URL = "http://hostname:8400"; private static final String USERNAME = "ccm_admin"; private static final String PASSWORD = "Passw0rd789$"; private static final String USER_ROLE = "developer"; public static List<String> getCCMStartCommand() { List<String> command = new ArrayList<String>(); command.add("cmd.exe"); command.add("/C"); command.add("ccm"); command.add("start"); command.add("-nogui"); command.add("-m"); command.add("-q"); command.add("-n "+USERNAME); command.add("-r "+USER_ROLE); command.add("-d "+DATABASE_PATH); command.add("-s "+SYNERGY_URL); command.add("-pw "+PASSWORD); return command; } private static String startCCMAndGetCCMAddress() throws IOException, CCMCommandException { int processExitValue = 0; List<String> command = getCCMStartCommand(); System.err.println("Will run: "+command); ProcessBuilder procBuilder = new ProcessBuilder(command); procBuilder.redirectErrorStream(true); Process proc = procBuilder.start(); BufferedReader outputBr = new BufferedReader(new InputStreamReader(proc.getInputStream())); try { proc.waitFor(); } catch (InterruptedException e) { processExitValue = proc.exitValue(); } String outputLine = outputBr.readLine(); outputBr.close(); if (processExitValue != 0) { throw new CCMCommandException("Command failed with output: " + outputLine); } if (outputLine == null) { throw new CCMCommandException("Command returned zero but there was no output"); } return outputLine; } The output of the System.err.println(...) is: Will run: [cmd.exe, /C, ccm, start, -nogui, -m, -q, -n ccm_admin, -r developer, -d /path/to/db/databasename, -s http://hostname:8400, -pw Passw0rd789$]

    Read the article

  • Run a shell command with arguments from powershell script

    - by Mike Weerasinghe
    Hello, I need to extract and save a some tables from a remote SQL database using bcp. I would like to write a powershell script to invoke bcp for each table and save the data. So far I have this script that creates the necessary args for bcp. However I can not figure out how to pass the args to bcp. Every time I run the script it just shows the bcp help instead. This must be something really easy that I am not getting. #commands bcp database.dbo.tablename out c:\temp\users.txt -N -t, -U uname -P pwd -S <servername> $bcp_path = "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\bcp.exe" $serverinfo =@{} $serverinfo.add('table','database.dbo.tablename') $serverinfo.add('uid','uname') $serverinfo.add('pwd','pwd') $serverinfo.add('server','servername') $out_path= "c:\Temp\db\" $args = "$($serverinfo['table']) out $($out_path)test.dat -N -t, -U $($serverinfo['uid']) -P $($serverinfo['pwd']) -S $($serverinfo['server'])" #this is the part I can't figure out & $bcp_path $args

    Read the article

  • How to print PDF on default network printer using GhostScript (gswin32c.exe) shell command

    - by Maciej
    I'd like to print PDF file(s) on windows' network printer via GhostScript. (I dont want to use Adobe Reader) I've read gswin32c.exe which can do the job. I experimented with many commands and coudn't find the way how to force gs to print PDF on my (windows default) network drive. I don't need point exact network printer- default can be used. But if there is no such option I'm happy to pass printer name as well. (I've tried with param -SDevice="\server_IP\printer_name" but this didnt work as well...) Command working under Windows cmd: gswin32c -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=1 -sDEVICE=ljet4 -sOutputFile="\\spool\\\Server_Name\Printer_name" "C:\test.pdf" Method created base on above - doesnt work and thorws exception. (Error code = 1) /// <summary> /// Prints the PDF. /// </summary> /// <param name="ghostScriptPath">The ghost script path. Eg "C:\Program Files\gs\gs8.71\bin\gswin32c.exe"</param> /// <param name="numberOfCopies">The number of copies.</param> /// <param name="printerName">Name of the printer. Eg \\server_name\printer_name</param> /// <param name="pdfFileName">Name of the PDF file.</param> /// <returns></returns> public bool PrintPDF (string ghostScriptPath, int numberOfCopies, string printerName, string pdfFileName) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.Arguments = " -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=" + Convert.ToString(numberOfCopies) + " -sDEVICE=ljet4 -sOutputFile=\"\\\\spool\\" + printerName + "\" \"" + pdfFileName + "\""; startInfo.FileName = ghostScriptPath; startInfo.UseShellExecute = false; Process process = Process.Start(startInfo); return process.ExitCode == 0; } Any idea how to make it working under C#?

    Read the article

  • KSH shell script won't execute and returns 127 (not found)

    - by Chris Knight
    Can anyone enlighten me why the following won't work? $ groups staff btgroup $ ls -l total 64 -rw-rw---- 1 sld248 btgroup 26840 Apr 02 13:39 padaddwip.jks -rwxrwx--- 1 sld248 btgroup 1324 Apr 02 13:39 padaddwip.ksh $ ./padaddwip.ksh ksh: ./padaddwip.ksh: not found. $ echo $? 127 This is nearly identical to another script which works just fine. I can't see any differences between the two in terms of permissions or ownership. thanks in advance!

    Read the article

  • Killing HTML nodes from shell

    - by hendry
    Need a solution to kill nodes like <footer>foobar</footer> and <div class="nav"></div> from many several HTML files. I want to dump a site to disk without the menus and footers and what not. Ideally I would accomplish this task using basic unix tools like sed. Since it's not XML I can't use xmlstarlet. Could anyone please suggest recipes, so I can ideally have a script running kill-node.sh 'div class="toplinks"' *.html to prune the bits I don't want. Thank you,

    Read the article

  • unknown error in shell

    - by lego69
    can somebody explain me what does this error mean: > ./rank lines.in 'nknown option: `- Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]. this is my script rank: #! /bin/tcsh -f set line = `cat ${1}` echo $line I think that the problem I have is with first row #! /bin/tcsh -f I'm working on Windows! but after I wrote script on windows editor, I converted it using dos2unix rank, what can be the problem, thanks in advance for any help

    Read the article

  • Exclude a string from wildcard search in a shell

    - by steigers
    Hello everybody I am trying to exclude a certain string from a file search. Suppose I have a list of files: file_Michael.txt, file_Thomas.txt, file_Anne.txt. I want to be able and write something like ls *<and not Thomas>.txt to give me file_Michael.txt and file_Anne.txt, but not file_Thomas.txt. The reverse is easy: ls *Thomas.txt Doing it with a single character is also easy: ls *[^s].txt But how to do it with a string? Sebastian

    Read the article

  • running shell commands with gnu clisp

    - by Paul Nathan
    I'm trying to create a "system" command for clisp that works like this (setq result (system "pwd")) ;;now result is equal to /my/path/here I have something like this: (defun system (cmd) (ext:run-program :output :stream)) But, I am not sure how to transform a stream into a string. I've reviewed the hyperspec and google more than a few times.

    Read the article

  • perl + export param in to perl syntax in shell script

    - by yael
    hi I have the following script that replace a param to b param and match only the c parameter in line how to change the perl syntax: "if /$c/" in order to export c param to the follwoing perl syntax !/bin/bash export a='@d&' export b='new text' export c='bla bla' echo $c | perl -pe 'next if /^#/; s/(^|\s)\Q$ENV{a}\E(\s|$)/$1$ENV{b}$2/ if /$c/'

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >