Search Results

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

Page 75/271 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • How to pass parameters to a Linux Bash script?

    - by chun
    I have a Linux bash script 'myshell'. I want it to read two dates as parameters, for example: myshell date1 date2. I am a Java programmer, but don't know how to write a script to get this done. The rest of the script is like this: sed "s/$date1/$date2/g" wlacd_stat.xml >tmp.xml mv tmp.xml wlacd_stat.xml

    Read the article

  • Iterate through XML with xmlstarlet

    - by hendry
    I have the following XML: <?xml version="1.0" encoding="UTF-8"?> <test-report> <testsuite> <test name="RegisterConnection1Tests"> <testcase name="testRregisterConnection001"></testcase> <testcase name="testRegisterConnection002"></testcase> </test> <test name="RegisterConnection2Tests"> <testcase name="testRregisterConnection001"></testcase> <testcase name="testRegisterConnection002"></testcase> </test> </testsuite> </test-report> And I want the output: RegisterConnection1Tests,testRregisterConnection001 RegisterConnection1Tests,testRregisterConnection002 RegisterConnection2Tests,testRregisterConnection001 RegisterConnection2Tests,testRregisterConnection002 I'm confused as to how to show the children as I expected xmlstarlet sel -t -m 'test-report/testsuite/test' -v '@name' -v '//testcase/@name' -n $1 to work, though it only inputs: RegisterConnection1TeststestRregisterConnection001 RegisterConnection2TeststestRregisterConnection001

    Read the article

  • bash: listing files in date order, with spaces in filenames

    - by Jason Judge
    I am starting with a file containing a list of hundreds of files (full paths) in a random order. I would like to list the details of the ten latest files in that list. This is my naive attempt: ls -las -t `cat list-of-files.txt` | head -10 That works, so long as none of the files have spaces in, but fails if they do as those files are split up at the spaces and treated as separate files. I have tried quoting the files in the original list-of-files file, but the here-document still splits the files up at the spaces in the filenames. The only way I can think of doing this, is to ls each file individually (using xargs perhaps) and create an intermediate file with the file listings and the date in a sortable order as the first field in each line, then sort that intermediate file. However, that feels a bit cumbersome and inefficient (hundreds of ls commands rather than one or two). But that may be the only way to do it? Is there any way to pass "ls" a list of files to process, where those files could contain spaces - it seems like it should be simple, but I'm stumped.

    Read the article

  • Listing time every second as a Bash script

    - by Caleb
    Hello all, first time here as I've finally started to learn programming. Anyway, I'm just trying to print the time in nanoseconds every second here, and I have this: #!/usr/bin/env bash while true; do date=(date +%N) ; echo $date ; sleep 1 ; done Now, that simply yields a string of date's, which isn't what I want. My learning has been rather messy, so I hope you'll excuse me for this if it's really simple. Also, I did manage to fine this, that worked on the prompt: while true ; do date +%N ; sleep 1 ; done But that obviously doesn't work as a script.

    Read the article

  • How to launch git bash window with particular working directory using a script?

    - by holocronweaver
    How can I launch a new Git Bash window with a specified working directory using a script (either bash or Windows batch)? My goal is to launch multiple Git Bash windows from a single script, each Bash terminal set to a different working directory. This way I can quickly get to work after booting computer instead of having to open Git Bash windows and navigating each one to the correct working directory.

    Read the article

  • Parsing Strings ( .crt files )

    - by user1661521
    Base Knowledge : I have a .crt file ( certification authoritie file ) and he is composed of many fields but in one line that resumes this question i have this : Certificate: ...(alot of stuff before)... Subject: C=US, ST=Maryland, L=Pasadena, O=Brent Baccala, OU=FreeSoft, CN=www.freesoft.org/[email protected] Subject Public Key Info: ...(alot of stuff after) and i need to parse the file to populate a .csv file and i have that done the problem that i need help is, i need to get the field: CN=www.fresoft.org but when i get this kind of CN=...(Value instead of the ...) with alot of slashes i get a error in the parsing like the raw string is: CN=foo/bar/the/hell/emailAddress=blablabla and i need only: foo/bar/the/hell and for a moment i got that in the correct column but when i dont have the emailAddress something just fail in my parsing and i then get in my CN .csv column the information wrong instead of |CN| foo/bar/the/hell i get: |CN| OU=FreeSoft, foo/bar/the/hell. I have this code doing the CN parsing: #!/bin/bash subject_line=$(echo $cert | grep -o "Subject:.*Subject Public Key Info") cn=$(echo $subject_line | grep -o "CN=.*" ) if [ $(echo $cn | grep -c ".*email.*") -gt 0 ]; then end_cn=$(echo $cn | grep -b -o emailAddress) end_cn_idx=$(echo $end_cn | grep -o .*:) final_end_cn=${end_cn_idx:0:-1} common_name=${cn:3:$final_end_cn-4} echo $common_name else end_cn=$(echo $cn | grep -b -o "Subject Public Key Info") end_cn_idx=$(echo $end_cn | grep -o .*:) final_end_cn=${end_cn_idx:0:-1} common_name=${cn:3:$final_end_cn-5} echo $common_name fi

    Read the article

  • Exit SSH from the script

    - by Kimi
    I Want to exit ssh: Does the below line work: ssh -f -T ${USAGE_2_USER}@${USAGE_2_HOST} Or do i need to write it some other way . Please tell should I use exit with ssh an how?

    Read the article

  • SVN - Get all commit messages for a file?

    - by davidosomething
    Is there a way to get a nice list of all commit messages sorted by file? Something like this (as you can see, I don't want the messages specific to a certain file, just show messages for the entire commit if the file was part of the commit, repeats ok): -- index.php 2010-01-02 03:04:05 * added new paragraph 2010-01-01 03:04:05 * moved header out of index.php into header.php * header.php initial check-in 2009-12-31 03:04:05 * index.php initial check-in -- header.php 2010-01-03 03:04:05 * added new meta tags 2010-01-01 03:04:05 * moved header out of index.php into header.php * header.php initial check-in Additional information: svn log filename does something similar, but I want it to do this: get a list of files that have changed between yyyy-mm-dd (r2) and yyyy-mm-dd (r4) (i.e. svn log -q -v -r 2:4 changedfiles.txt strip extraneous crap from changedfiles.txt svn log each file in that list, as in: svn log < changedfiles.txt combinedlog.txt (just pseudocode, i know svn log takes arguments not input, but can't be bothered to write it out)

    Read the article

  • Average and maximum size of directories

    - by Mircea
    I have a directory and a bunch of sub-directories like this: - directory1 (sub-dir1, sub-dir2, sub-dir3, sub-dir4, sub-dir5...........and so on, hundreds of them...) How do I find out what is average size of the sub-directories? And how do I find what is the maximum size of the sub-directories? All using Unix commands... Thanks.

    Read the article

  • mkdir error in bash script

    - by Don
    Hi, The following is a fragment of a bash script that I'm running under cygwin on Windows: deployDir=/cygdrive/c/Temp/deploy timestamp=`date +%Y-%m-%d_%H:%M:%S` deployDir=${deployDir}/$timestamp if [ ! -d "$deployDir" ]; then echo "making dir $deployDir" mkdir -p $deploydir fi This produces output such as: making dir /cygdrive/c/Temp/deploy/2010-04-30_11:47:58 mkdir: missing operand Try `mkdir --help' for more information. However, if I type /cygdrive/c/Temp/deploy/2010-04-30_11:47:58 on the command-line it succeeds, why does the same command not work in the script? Thanks, Don

    Read the article

  • Extract log file

    - by k38
    Hi, xxxxxxxxmessageyyyyyyymessagexxxxxxxxxx xxxxxxxxmessagezzzzzzzmessagexxxxxxxxxx xxxxxxxxmessageaaaaaaamessagexxxxxxxxxx xxxxxxxxmessageyyyyyyymessagexxxxxxxxxx The above is my log file I need to extract the phrase which is inside the message tag and I need to save the distinct messages in a file in the above example I need to save zzzzzzz and aaaaaaa to a file. What are the unix commands I need to use.

    Read the article

  • bash command history update before execution of command

    - by Jon
    Hi, Bash's command history is great, especially it is useful when adding the history -a command to the COMMAND_PROMPT. However, I'm wondering if there is a way to log the commands to a file as soon as the Return key is pressed, e.g. before starting the command and not on completion of the command (using the COMMAND_PROMPT option would save the command once the prompt is there again). I read about auditing programs like snoopy and session recorder like script but I thought they're already too complex for the simple question I have. I guess that deactivating that script logs all the output of the command would lead already in the right direction but isn't there a quicker way to solve that probelm? Thanks, Jon

    Read the article

  • How do I test if a variable is a number in bash?

    - by Flávio Amieiro
    I just can't figure out how do I make sure an argument passed to my script is a number or not. All I want to do is something like this: test *isnumber* $1 && VAR=$1 || echo "need a number" Any help? UPDATE: I managed (whit Charles' help) to do it, but I'm not yet sure it's the best way to do that (even though it worked on my tests). This is how it ended up: [[ $1 =~ "^[0-9]+$" ]] && echo "numero" && exit 0 || echo "nao numero" && exit 1

    Read the article

  • Extract a correct 16x16 icon assigned to a file?

    - by a-g
    I tied SHGetFileInfo and ExtractIconEx, both return a normal 32x32 icon and 16x16 with only 16 colors, and it looks awful. How do I extract a full color icon? My code SHFILEINFO shinfo = new SHFILEINFO(); IntPtr hImgSmall = SHGetFileInfo(fileName, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), SHGFI_ICON | SHGFI_SMALLICON); Icon icon = (Icon)System.Drawing.Icon.FromHandle(shinfo.hIcon).Clone(); DestroyIcon(shinfo.hIcon);

    Read the article

  • Why Does Piping Binary Text to the Screen often Horck a Terminal

    - by Alan Storm
    Imaginary Situation: You’ve used mysqldump to create a backup of a mysql database. This database has columns that are blobs. That means your “text” dump files contains both strings and binary data (binary data stored as strings?) If you cat this file to the screen $ cat dump.mysql you’ll often get unexpected results. The terminal will start beeping, and then the output finishes scrolling by you’ll often have garbage chacters entered on your terminal as through you’d typed them, and sometimes your prompts and anything you type will be garbage characters. Why does this happen? Put another way, I think I’m looking for an overview of what’s actually happening when you store binary strings into a file, and when you cat those files, and when the results of the cat are reported to the terminal, and any other steps I’m missing.

    Read the article

  • UNIX sort: Sorting something from the clipboard

    - by Iker Jimenez
    The other day I saw a colleague of mine using sort to sort a number of lines he copied from a text file. I've been trying to reproduce it myself and I cannot seem to find how. The requirements are as follow: Use sort from command line, plus whatever else you need to add to configure input Paste the text to be sorted from the clipboard Get the sorted result in the console

    Read the article

  • Linux standard input issue

    - by George2
    Hello everyone, I am new to Linux. And I am using Red Hat Enterprise Version 5. There is a ruby program which use standard input as its input (e.g. the Ruby program process input from standard input). I think standard input should be keyboard, correct? So, I think other kinds of input (non-standard input) should not work (i.e. the ruby program should not be able to read input from such non-standard input), but actually I have tried using pipe works, I am so confused because I think pipe should be some other kinds of input -- other than standard input, why it could work? i.e. put text "123" in abc.txt with pipe, could achieve the same result as using keyboard as input to type "123" for the ruby program. Here is the sample which works and makes me confused, cat abc.txt | ~/test/rubysrc/foo.rb thanks in advance, George

    Read the article

  • Checking if a directory contains files

    - by ionn
    How do I check if a directory contains files? Something similar to this: if [ -e /some/dir/* ]; then echo "huzzah"; fi; but which works if the directory contains one or several files (the above one only works with exactly 0 or 1 files).

    Read the article

  • why the output of ls is like this

    - by dorelal
    I am using snow leopard and this is what I get in my terminal. By default I am using bash. > ls c* clock: PSD demo.html jquery.tzineClock script.js styles.css clock2: clojure-presentations: Clojure-1up.pdf ClojureInTheField-1up.pdf license.html Clojure-4up.pdf README ClojureForRubyists-1up.pdf keynote coffee-script: Cakefile README bin examples index.html package.json test LICENSE Rakefile documentation extras lib src vendor

    Read the article

  • How to feed data over STDIN to multiple external commands in ruby.

    - by Erik
    This question is a bit like my previous (answered) question: How to run multiple external commands in the background in ruby. But, in this case I am looking for a way to feed ruby strings over STDIN to external processes, something like this (the code below is not valid but illustrates my goal): #!/usr/bin/ruby str1 = 'In reality a relatively large string.....' str2 = 'Another large string' str3 = 'etc..' spawn 'some_command.sh', :stdin => str1 spawn 'some_command.sh', :stdin => str2 spawn 'some_command.sh', :stdin => str3 Process.waitall

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >