Tag Info

Hot answers tagged

5

A better option than providing the password on the command line at all is to make a ~/.my.cnf file with the credentials in it: [client] password=something That way they are also protected against someone looking at the ps output, or your shell history. That said, you can turn off the watch title entirely with the -t or --no-title option, which will: ...


4

docx2txt works on the information in the docx file which is a zipped set of XML files. With regards to line wrapping the .docx XML data only includes information about paragraphs and hard-breaks, not about soft-breaks. Soft-breaks are a result of rendering the text in a specific font, font-size and page width. docx2txt normally just tries to fit text in 80 ...


4

sed: Call the sed command -i: Pass sed the -i option: Modify the file in-place 's|\(LAYOUT PATH \).*|\1 "../GDS/'$1'.gds"|g': The '...'$1'..' are used to make this whole part one single argument to the sed command s|\(LAYOUT PATH \).*|\1 "../GDS/'$1'.gds"|g: s|pattern|replacement|options: s is the substitute (or search and replace) command, the | ...


4

eval does a printf of its arguments and then runs it as a command. So you can take your printf argument list, insert set $MyVar = at the beginning, and eval it. (gdb) eval "set $MyVar = \"Hello %d\"", 7 (gdb) print $MyVar $2 = "Hello 7"


3

use readlink to get the target of a symlink: TARGET=$(readlink $1) then use the power of shell, to remove everything before the last /; ID=${TARGET##*/} or remove everything after the last /: BASE=${TARGET%/*} then use the power of shell to do simple arithmetic NEWID=$((ID+1)) finally glue them together: NEWTARGET=${BASE}/${NEWID} or, in one ...


3

history It shows you what your shell last did. Every command. No output. It is editable.


3

It will not only show up on your screen, but also in ps output, in your ~/.bash_history (though that one should only be readable to you and the admins) and possibly in some audit or performance logs. You should not pass passwords as arguments to commands. Arguments to commands should be considered public knowledge. For mysql, use ~/.my.cnf as Michael has ...


2

Are you okay with typing the password when you run it? You can read it in a bash script without making it visible in the terminal, saving to history, etc: #!/bin/bash if ! IFS= read -rs -p "Enter password: " password < /dev/tty 2> /dev/tty then echo "Password entry failed" exit 1 fi somecommand -user me -password $password Looking at the other ...


1

I can comment on Gnome's "Application is not responding" dialog, but not directly answer your question. It seems that both Metacity and Mutter use meta_display_ping_window() function to determine the status of a window (read the doc comment in display.c). The default timeout PING_TIMEOUT_DELAY is 5 s. Ping-timeout and response are handled internally by ...


1

To get file name from its full path, you can use basename: $ basename /home/cuonglm/test.pl test.pl So you can do something like: for f in * do filename=$(basename "$f") # Do sftuff here done


1

You can do the following #!/bin/bash read -p "URL to check: " url if curl --output /dev/null --silent --head --fail "$url"; then printf '%s\n' "$url exist" else printf '%s\n' "$url does not exist" fi The if statements are not necessary though, I put them here just to illustrate the flow of the script.


1

curl -Is http://www.yourURL.com | head -1 You can try this command to check any URL.Status code 200 OK means that the request has succeeded and the URL is reachable. You can also test URL availability and get the response code using telnet command telnet www.yourURL.com 80 80 is the port number.


1

It would probably be easier to have two separate versions of the script. Since it is short it may not be worth adding extra code to handle the differences between the two formats as jw013 suggested. On the other hand if you had a larger script it would probably be easier to have one and make the script execute different commands depending on where it is ...


1

With zsh: for dir (/home/usr/ProjZ/programs/*(/)) rm -f $dir/*.js(.NOL[2,-1]) Note that if there are several files with the biggest size, only one will be retained. Which one that will be depends on the order they appear in the current directory (which generally is more or less random). GNUly (recent GNU sed for -z), the equivalent would look like: for ...



Only top voted, non community-wiki answers of a minimum length are eligible