I was moving some files around and for some reason after I restarted my Home folder has become the desktop.I realised this was because I moved "~/Desktop" somewhere else" and now it was seeing "~" as my desktop.I moved the Desktop dir back to where it was, inside ~ but I can't get ubuntu to stop seeing ~ as my desktop. I want it to display the contents of ~/Desktop on the desktop, but it keeps displaying ~ instead on the desktop
I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:
Code: #!/bin/bash cat > ~/generateGridmix2data.sh << END
I just recently learned about the wonderful little lpr command- and using man -t (bash command) to beautifully print man pages for reference- but is there a way to print both sides of the paper using a printer so equipped?
I have a big bash script ,its goal is to download movie one by one . But I often get into a problem: if this script is executed in cron,it often does not completely download the movie.I often find the movies it downloaded are several KB while the movie is actually 20MB.So I think it is because it did not wait for finishing one task ,and jump to download another.So I want to know ,is there a way to force the bash script to wait until one movie downloaded completely and then start to download another movie ?
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?
I am trying to grep multiple numbers from file, grep does have the -f option for that.
Code: grep -f <`seq 500 520` /etc/passwd I know this could be done with
Code: for i in `seq 500 520`; do grep "$i" /etc/passwd; done But my question is fare more behind this example. It is possible to redirect one command output which will be treat as a content of file for another command ?
I've just installed java (jre-6u21-linux-i586.bin) on Red Hat 4.4 AS and issued this command to check the java version: java -versionand got :bash :java: command not found
I would like to write a shell script that displays the number of days, hours and seconds left until a certain date and time. What commands would I use?
First, i have no experience with javascript. I came across an interesting site and I'm curious if I could make a private webpage to call some shell commands or just open a terminal.Yes, i know this could potentially be malicious and possibly illegal. Again it's for my own private usage.
Is running a command in the Alt+F2 prompt possible in a bash script?I need this for a launcher for gnome-shell.For it I have written a little script to check if the process gnome-shell is alive and act accordingly.The script works fine, I just don't know how to write "debugexit" to the Alt+F2 prompt, as that is the only decent way I have found to shut gnome-shell down and going back to gdm desktop smoothly.
I recently installed 10.04, in the process of installing MythTV... I'm looking for installed files and find bash no longer finds updatedb or locate commands. I did change /etc/hosts and /etc/hostname to change the name of the box. Could this have hosed those commands? I tried them as root... sudo -i, same result...
I am trying to use the date command in a simple bash script as below:
#!/bin/sh this_date=`date` echo "The date is $this_date"
This script seems to work only if a surround the command with the `` characters, which I copied from another script. Can anyone tell me why this is, and how I can insert these characters from my keyboard,which only has normal quote and double-quote characters?
I'm used to being able to put a script in ~/bin and having it overrule the system version of a command. However for "time" or "kill" since the bash shell implements a version of the command (i.e. /bin/ version is not used) doing this is not enough. How can I get the shell to run my own version instead of the version in the shell.I understand the implications of doing this. I know what I'm doing, I can always /bin/whatever if I want to get the old version (or just chmod -x ~/bin/whatever).
I am having problems installing fortran g95 compiler. I followed the exact instructions listed on the website The G95 Project (click on manual tab for further details), but I am still getting this error when I try using the driver:
shamo@linux-wrws:~> g95 bash: g95: command not found
Here is what I did:
>wget -O - http://ftp.g95.org/g95-x86-linux.tgz | tar xvfz -
The program installed properly, and I was able to verify the installation in /usr/share/g95-install. All the libraries were installed, and I was able to run the actual "executable" when I cd'ed to its directory) Next I created a symbolic link to the driver so that I could run from anywhere using g95 command:
I understand that $! is the PID of a command. For example:
Code: #!/bin/bash myprogram & echo "PID of myprogram is $!"
I'd like to send the output of "myprogram" to both console and to a log file using the "tee" command but I also want to store the PID of "myprogam". Something like this:
Code: #!/bin/bash myprogram | tee ./logfile & echo "PID of myprogram is $!"
The problem is that $! is now the PID of "tee" rather than the PID of "myprogram".
I often want to extract some info using awk from a variable/filename while running other things using xargs and sh. Below is an example: Code: ls -1 *.txt | xargs -i sh -c 'NEW=`echo $0 | awk -F'_' '{print $1}'`; echo $NEW' {}
In the above case I would like to grab just the first field from a filename (delimited by '_') from within an sh command. This is a simplified example, where normally I would be doing some further data processing with the sh command(s).
The error message that I get is: Code: }`; echo $NEW: -c: line 0: unexpected EOF while looking for matching ``' }`; echo $NEW: -c: line 1: syntax error: unexpected end of file. I haven't been able to figure out how to escape the awk command properly.
What does the following Shell program do ??: () { :| : &} ; :Warning: My computer got hung when i tried to execute this.Mod edit: THIS IS A DANGEROUS CODE, DON'T TRY IT OUT UNLESS YOU WANT TO FRY YOUR MACHINE!
Code: i=0 while [ $i -lt $ARRAYLEN ]; do if ["$META1" = "$array"]; then META1FLAG=1 else META1FLAG=0 fi let i++ done While $array contains a word like "start"
When I run the script, In the terminal I either get the response: myscript.sh: line 3: [: missing ']' or if $META1 contains the same word "start, I get: myscrit.sh: line 3: [start: command not found
The purpose of the script is to evaluate a parameter that a user might include when they invoke my script, and compare it to some data that $META1 might contain. If they match I want to set a flag and later launch Xine. If they do not match, I want to set a flag to zero and do something else. I'm a bit lost as to what the responses are trying to tell me in the terminal window when I run this script.
I was reading in one of my redhat books that this command would make linux rered the inittab file but whin I try it I get Bash: init: command not found.