Search Results

Search found 7607 results on 305 pages for 'bash profile'.

Page 18/305 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Bash: verify that process has stopped

    - by pfac
    I'm working on script meant to start/stop a set of services. For stopping, it has to terminate many processes which take a while and might hang. The script needs to verify that the process has indeed terminated, and send an email if such does not happen after a given period. This is what I have: pkill -f "stuff" for i in {1..30}; do VERIFICATIONS=$i if verification_command then echo "It's gone" break fi sleep 2 done if [ $VERIFICATIONS -ge 30 ]; then echo "failed to terminate" # send mail fi Is there a better way to do this?

    Read the article

  • Clean logging with BASH

    - by Matt Krouse
    I have a script that deletes files 7 days or older and then logs them to a folder. It logs and deletes everything correctly but when I open up the log file for viewing, its very sloppy. log=$HOME/Deleted/$(date) find $HOME/OldLogFiles/ -type f -mtime +7 -delete -print > "$log" The log file is difficult to read Example File Output: (when opened in notepad) /home/u0146121/OldLogFiles/file1.txt/home/u0146121/OldLogFiles/file2.txt/home/u0146121/OldLogFiles/file3.txt Is there anyway to log the file nicer and cleaner? Maybe with the Filename, date deleted, and how old it was? Any suggestions help!

    Read the article

  • how to modify another user's .profile from the recovery console?

    - by Pinpin
    Pretty much everything is in the title, really! ;) I installed a few components to compile go programs, and the last step was to add the go directory to the path. Being a total ubuntu noob, I added the line PATH="Path/To/Folder", after the one that was already there. After the first reboot I can no longer log into ubuntu (the screen black-out for a while and then I'm back to the login screen, and the same chime greets me.) I've been able to boot in recovery mode, open the root's profile with vi, but I cant find my other user's profile, nor pretty much anything.. Any hint would be greatly appreciated! Pascal

    Read the article

  • In Bash, how can I obtain the directory path from the previous command's last argument

    - by Beaming Mel-Bin
    I frequently have to do this. For example: $ vim /etc/pam.d/sudo $ vim /etc/pam.d/sudo-i $ cd /etc/pam.d/ # Figure I should just go to the directory Now, is there a way I could obtain the directory of the last argument when it's a file path? I'm asking this cause I recently became aware of the $_ variable that has become useful. Was wondering if there's some other commandline fu that might come in handy.

    Read the article

  • BASH - Run command for each line in output of previous command

    - by user1582375
    All, I am want to request all network services using: networksetup -listallnetworkservices I then want to run the below command for each line in produced from the above command: networksetup -setautoproxyurl "A LINE FROM ABOVE" http://etc... Adiitonally, I only want to issue the setautoproxyurl command for service with "Ethernet" or "Wi-Fi" in the name networksetup -listallnetworkservices | while read line; do networksetup -setautoproxy $line http://etc...

    Read the article

  • (Mac Terminal) Looking for a recommendation for a BASH manual

    - by Mental Sticks
    Hi, I've just begun to use the Terminal in Mac OS X and I've found the 'man' command very useful, although very often the explanations are too compact or complicated for me. I am looking for a very basic reference guide – like O'Reilly makes, for example. But in there I didn't find an entry for basic commands like ls or ln and a layman's explanation of all the flags and options. Could anybody recommend me something? Thansk a bunch in advance

    Read the article

  • Prevent * to be expanded in the bash script

    - by Alex Farber
    Linux bash script: #!/bin/bash function Print() { echo $1 } var="*" Print $var Execution results: alex@alex-linux:~/tmp$ ./sample-script sample-script "*" is expanded to the list of files, which is actually script itself. How can I prevent this and see actual variable value? In general case, var can be more complicated than "*", for example: "home/alex/mydir/*".

    Read the article

  • bitwise XOR a string in Bash

    - by ricky2002
    Hi. I am trying to accomplish a work in Bash scripting. I have a string which i want to XOR with my key. #!/bin/sh PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH teststring="abcdefghijklmnopqr" Now how do i XOR the value of teststring and store it in a variable using bash? Any help will be appreciated.

    Read the article

  • Read a variable in bash with a default value

    - by rmarimon
    I need to read a value from the terminal in a bash script. I would like to be able to provide a default value that the user can change. # Please enter your name: Ricardo^ In this script the prompt is "Please enter your name: " the default value is "Ricardo" and the cursor would be after the default value. Is there a way to do this in a bash script?

    Read the article

  • hex dump of file in bash

    - by David Raswik
    How do I create a UNMODIFIED hex dump of a binary file in linux with bash? The od and hexdump commands both insert spaces in the dump, I DON'T WANT THIS, I need something that will simply write a long string with all the hex characters without inserting spaces or newlines in the output. How do I do this in bash?

    Read the article

  • Bash: Correct way to Iterate over Map

    - by Lars Tackmann
    In Bash I can create a map (hashtable) with this common construction hput() { eval "$1""$2"='$3' } hget() { eval echo '${'"$1$2"'#hash}' } and then use it like this: hput capitols France Paris hput capitols Spain Madrid echo "$(hget capitols France)" But how do I best iterate over the entries in the map ?. For instance, in Java I would do: for (Map.Entry<String, String> entry : capitols.entrySet()) { System.out.println("Country " + entry.getKey() + " capital " + entry.getValue()); } is there a common way of accomplishing something similar in Bash ?.

    Read the article

  • Listing defined functions in bash

    - by Charles Duffy
    I'm trying to write some code in bash which uses introspection to select the appropriate function to call. Determining the candidates requires knowing which functions are defined. It's easy to list defined variables in bash using only parameter expansion: $ prefix_foo="one" $ prefix_bar="two" $ echo "${!prefix_*}" prefix_bar prefix_foo However, doing this for functions appears to require filtering the output of set -- a much more haphazard approach. Is there a Right Way?

    Read the article

  • bash: expanding variables with spaces

    - by adam n
    i have a file called physics 1b.sh in bash, if i try x="physics 1b" grep "string" "$x".sh grep complains: grep: physics 1b: No such file or directory. However, when i do grep "string" physics\ 1b.sh it works fine. So i guess the problem is something to do with the variable not being expanded to include the backslash that grep needs to recognize the space. How do i get this to work? using bash 3.2, mac os 10.6.

    Read the article

  • Stop execution of python script when parent Bash shell script is killed

    - by jrdioko
    I'm working on a Bash shell script that runs several Python scripts like so: cd ${SCRIPT_PATH} python -u ${SCRIPT_NAME} ${SCRIPT_ARGS} >> $JOBLOG 2>&1 At one point, I killed the shell script (using kill PID), but the Python script continued running, even after the script terminated. I thought these would die as soon as the main script died. What am I misunderstanding about Bash scripting, and what can I do to get the functionality I'm looking for? Thanks in advance!

    Read the article

  • Embed bash in python

    - by Werner
    Hi, I am writting a python script and I am running out of time. I need to so some things that I know pretty well in bash, so I just wonder how can I embed some bash lines into a python script. Thanks

    Read the article

  • Bash and sort files in order

    - by Werner
    Hi, with a previous bash script I created a list of files: data_1_box data_2_box ... data_10_box ... data_99_box the thing is that now I need to concatenate them, so I tried ls -l data_* but I get ..... data_89_box data_8_box data_90_box ... data_99_box data_9_box but I need to get in the sucession 1, 2, 3, 4, .. 9, ..., 89, 90, 91, ..., 99 Can it be done in bash?

    Read the article

  • converting bash script to .bat

    - by Robokop
    #!/bin/bash function usage(){ cat <<EOF USAGE: $0 [strategylist] valid strategies are: ALLD ALLC TitForTat JOSS WeightedRandom Tester EOF exit 1 } [ -z $1 ] && usage javac robsAgents/*.java robsAgents/behaviours/*.java agentlist='leader:robsAgents.TournamentLeader' agentlist=$agentlist";$1:robsAgents.Contestant" while shift; do agentlist=$agentlist";$1:robsAgents.Contestant" done java jade.Boot -gui -host 127.0.0.1 "$agentlist" i have above bash script and have no access to a windows computer and i need to convert it to a .bat file, but don't even know how to do the shift and argument parsing

    Read the article

  • what does '-' stand for in bash?

    - by trybeingarun
    Hi, What exactly are the uses of '-' in bash? I know they can be used for 1. cd - # to take you to the old 'present working directory' 2. some stream generating command | vim - # somehow vim gets the text. My question is what exactly is - in bash? In what other contexts can I use it? Regards Arun

    Read the article

  • Bash, no-arguments warning, and case decisions

    - by Werner
    Hi, I am learning bash. I would like to do a simple script that, when not arguments given, shows some message. And when I give numers as argument,s depending on the value, it does one thing or another. I would also like to know suggestions for the best online manuals for beginners in bash Thanks

    Read the article

  • Parse contents of directory to bash command in a script

    - by ECII
    I have the directory ~/fooscripts/ and inside there are foo1.txt, foo2.txt, etc etc I have a command that takes the file foo1.txt as input and does some calculation. The output location etc is handled internally in fooprog fooprog -user-data=foo1.txt I would like to automate the whole thing in a bash script so that the script will parse all txt files in ~/fooscripts/ sequentially. I am a newbie in bash. Could anyone give me a hint?

    Read the article

  • Script Bash and History Unix

    - by user1107078
    i just start to use Script bash on UNIX and i didnt find a solution to write the first command in the history which start , for example , with ls. If i write in the shell history !ls it works but when i'm going to create a script it wont work. This is my example code #!/bin/bash set -o | grep history set -o history #echo "HISTFILE is $HISTFILE" #history "!ls"; #history #!ls history #it works Another Question why echo "HISTFILE is $HISTFILE" print me only HISTFILE is ?? Thanks

    Read the article

  • find: missing argument to -exec in bash script

    - by Mephi_stofel
    The following works fine when I type it exactly in the command line: find /<some_path>/{epson,epson_laser,epson_inkjet} -iname "*.ppd" -exec grep "\*ModelName\:" {} \; | sed 's/.*\"\(.*\)\"/\1/' However, when I try to call the following from a bash script I get find: missing argument to -exec'. I have also tried the following (in many variants): eval find "$1" -iname "*.ppd" -exec 'bash -c grep "\*ModelName\:" "$1" | sed "s/.*\"\(.*\)\"/\1/" \; as was mentioned in find-exec-echo-missing-argument-to-exec.

    Read the article

  • Ubuntu Bash Script changing file names chronologicaly

    - by Manifold
    I have this bash script where I am trying to change all *.txt files in a directory to their date of last modification. This is the script: #!/bin/bash # Renames the .txt files to the date modified # FROM: foo.txt Created on: 2012-04-18 18:51:44 # TO: 20120418_185144.txt for i in *.txt do mod_date=$(stat --format %y "$i"|awk '{print $1"_"$2}'|cut -f1 -d'.'|sed 's/[: -]//g') mv "$i" "$mod_date".txt done The error I am getting is: renamer.sh: 6: renamer.sh: Syntax error: word unexpected (expecting "do") Any help would be greatly appreciated. Thank you for your time.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >