I'm running Kubuntu Karmic on my Dell Inspiron laptop - about 200 bug fixes behind because my only available internet is a cellular connection on a crappy wi-fi router - and last night, I suspended it, but it shut down instead. Not a problem, it does this fairly often, figure the RAM gets jostled or something.
But when I go to boot it up, it gets stuck at the pre-loading screen before getting garbled and dropping to the shell, where it says "mount: mounting /dev/disk/by-uuid/[insert hex code here] failed: invalid argument". Of course, mounting /root/sys, /root/dev and /root/proc fails, (directory does not exist) and it gives me the busybox initramfs prompt.
my script has a variable which comes in the form +00.00 +0.00 -00.00 or -0.00 (the numbers can be any in that form) for any that have a + symbol I need to remove the +, but if it has a - symbol it needs to stay.
i need to make a new variable with the string from the old variable btut without any plus sign. I have tried a lot of different ways with no success, each thing I tried either left the + or removed the entire string. I think this should work but doesn't
I'm trying to write a base script which will divide an argument by 10 and then use that argument in another program. Since my argument can be a floating point number, I used bc to accomplish this. Here's an example of a simplified version of what I have so far:
<code>NUM=$(echo "scale=25;$1/10" | bc) #make sure the first argument was formatted correctly if [ $? -ne 0 ]
I need to write a script that will take 1 command line argument. The argument will be a username. The script will determine if the user exists on the system and will print an error if it does not. If the user does exist it will determine if the user is currently logged in, if the user is not logged in it will determine the last time the user logged in and display the file in the users home directory that was most recently modified.
I am trying to simulate a shell. So what I do is checking of having the parameters from standard input, suc as "/bin/ls -l /home/france/Documents", and then passing them to function execute, which at some point calls execvp(argv,argv)The problem is that I don't succeed in using these arguments, while if I call execvp(paramList,paramList) it works!!!! Where paramList is exactly what I would put on standard input, but defined statically.
Write a program that requires the user to input the name of a file as an argument. If the user fails to include one argument it should make use of a thread that handles a signal. The signal handler should tells the user Incorrect number of arguments and then calls the terminate signal on the process.
If the numbers of arguments are correct then the program should allocate memory space to the file (5MB) and create a child process that requests the user for a character that it should send to the parent. The child should keep request for data until the user keys in the character O. During each request it should pause for 10 seconds, send the character to the parent and then requesting again for another character.
The parent should get the character from the child. Do not make the parent wait for the child to finish requesting for data. Make use of pipes to facilitate communication between the parent and the child. A second child should be created to read and display data from the file. Make use of any appropriate Inter Process Communication technique to ensure that the second child and the parent do not access the file simultaneously (Mutual exclusion).
am coding a chat program in C (win32), where I need both the client and the server to communicate, without waiting for a reply from the other side, like the way we chat in any messenger. Is there any way of accomplishing it? I tried out CreateProcess() function, but am not clear how to specify the location of the file as an argument.If there are better techniques than CreateProcess(), then
I am attempting to script some tasks I have to do, but I have no control over one of the scripts I have to use... and they output all kinds of useless things on the screen. My goal is simple: Capture all output from their scripts, and create a progress line that only shows the most recent output from their stuff. So, here was my first solution; a file I called "spin":
To use it, you pass it a process ID and a file that contains the output from that process. As the process continues, a kurby dances on the screen (To let you know that the process has not hanged), and the tail of the output is shown (To let you know what it is doing). When the process ends, the kurby stops dancing and the time it took is displayed.
And here is the file I call "noise": Code: #!/bin/bash while [ i -lt 100 ];do i=1 echo "Look at me count!$" sleep 1 let "i=$i+1" done
This does nothing but create random output, for testing. It counts from 1 to 99 on the screen. To run my test, I do the following: Code: (noise) &>tmp.txt & spin $! tmp.txt
It works relatively well, but it is messy. I don't like creating a temp file, and I don't like the messy syntax for calling my program. I decided that I would rather move everything into the spin program, to make using it less messy: Code: #Spin Psuedo code #$1 = command I am about to run (exec $1) &>tmp.txt & spinX $! tmp.txt
By executing the process inside of the spin code, I can get rid of the tmp file later on without changing a lot of scripts (Or move it, or whatever). I can also call it by passing the command to the script, which I find more elegant.
So here is what I would like to know: 1) If possible, I would love to get rid of the tmp file all together, and store the most recent line of output from script 1 into a variable that script 2 can print out instead... is it possible? 2) How can I run a random command that is passed as an argument? Basic ones work fine, but anything with a pipe fails me.
Example of a script: Code: #!/bin/bash #myEcho.sh echo;echo "Recieved command: ";echo $1;echo; echo "Attempting to run command: ";echo exec $1
Example code for passing commands to script: > myEcho.sh "ls -al" #works > myEcho.sh 'ls -al' #works > myEcho.sh "ls -al|grep *.sh" #fail # Output: #ls: invalid option -- | #Try 'ls --help' for more information. > myEcho.sh "ls -al|grep "*.sh"" #fail # Output: #ls: invalid option -- | #Try ls --help' for more information. > myEcho.sh 'ls -al|grep *.sh' #fail # Output: #ls: invalid option -- | #Try 'ls --help' for more information.
the double quotes around "arg one" are dismissed ( argv = [ '--o', 'arg', 'one' ]. I've tried many combinations of single quotes/double quotes/backslashes, etc, to no avail. One hack solution I came up with, since I have the flexibility, was to replace all spaces in the quoted argument with a character that would be invalid in the argument (before the ssh call), and replace those with spaces in script.py. I would probably like to avoid this solution if at all possible.
I have a new problem; i want to call a subroutine's fortran which have a function in the argument and the compilation ran properly, but when i execute the program this shows me an "Segmentation fault". This is my c++ program:
Examples: Code: $ ./test.sh -a -c 2 operator is -gt remcount is ^ value missing!
Code: $ ./test.sh -b -c 2 operator is -lt remcount is ^ value missing!
Yet when "-c" is the first argument, its value is present: Code: $ ./test.sh -c 2 -b operator is -lt remcount is 2 What could I do to ensure the value of "-c" is picked up regardless of the argument order?