Fedora :: Add A Variable To Take User Input And Post That Imput?
Sep 25, 2009
I'm sure you all seen how you can use curl to post to you twitter acct. What I'm wondering is how to add a variable to take user input and post that imput.
Code:
#!/usr/bin/perl
"Enter tweet: ";
$msg = <STDIN>;
[Code]...
View 3 Replies
ADVERTISEMENT
Apr 8, 2010
I have a script in which it searches the password file for a username based on the user's input. Is there a way I can take the bad input and keep it in a variable. (one that keeps adding all the non-existent users)so how would I get non-existent users into another variable?
View 9 Replies
View Related
May 3, 2011
I'm trying to call a specific variable based on a user selection. For example:
Code: Select a file:
[1] foo.tar
[2] bar.tar
Enter a selection: I have already coded each possible selection to have its own variable. If the user selects 2 I need to select $SELECTED_TAR2, or if they select 1 I need to select $SELECTED_TAR1 and then do something like this behind the scenes:
Code: cp /home/user/$SELECTED_TAR2 /home/user/backup/$SELECTED_TAR2
I was thinking something like this:
Code: echo "Enter a selection: "
read -e SELECTED_NUMBER
cp /home/user/$SELECTED_TAR$SELECTED_NUMBER /home/user/backup
[code]....
View 2 Replies
View Related
Feb 25, 2010
I have a service that when shutdown requires a username and password. I use `read` in my script to gather this info because I can't have it in the file. When I run the init script by hand it will ask for the username and password and everything shutsdown properly. When I run reboot or halt I get no prompt. get user input in a shutdown process?
View 2 Replies
View Related
Feb 2, 2011
right now i am writing bash script for simple everyday todo tasks.script consisit of two files, fisrt is just script (which can delete/append /clear) and second one is todolist.txt which stores my notes.I am litlebit confused about sed!!for example, If my todolist.txt have these lines:
- Writing my Homework
- take my girlfriend to launch
- Take a break
How can sed take my input $@ and delete all line with name "Homework"..i trayed with many sed combination like:
Code:
sed s/$@//g
sed 'd/$@/'
and many more combination with ""/'' or bracket but nothing helped
View 5 Replies
View Related
Aug 22, 2010
I'm basically setting up two sshfs mounts and I have it set up so I run one command but type my password twice.Is there an easy to way to input a password using bash and pass that variable to another process asking for a password?
View 5 Replies
View Related
Aug 27, 2010
How can I to pass a perl variable into html input tag? For example, If a have got a cgi script:
Quote:
use CGI;
use DBI;
my $owner = $cgi->param('owner');
[code]....
How can I to pass $owner variable?
View 1 Replies
View Related
Jul 21, 2010
I'm trying to write a small script that will run as root, but launch a command with sudo as another user. I want that user to be whichever user is active user. That is, the user that is using GDM right now, or the one that is logged into the current console. (by current console, I don't mean the user running the script, but rather the user logged into the console currently displayed on the screen.)How can this be done?
Code:
ACTIVE_USER=`somecommand`
test `id -u pulse` -ge 1000 && sudo -u $ACTIVE_USER $*
What can I use for "somecommand"?
View 5 Replies
View Related
Feb 3, 2010
I need to create a single line of output from multiple and variable lines of input in a Linux bash shell script.
My input file looks like this:
Where there may be any number of umsecondaryphonenumber lines; if there is not a umsecondaryphonenumber line for a telephonenumber, I don't want to write any output.
So, the output file should look like:
The script I have so far is:
My question is - how do print each of the elements of an array in one record - i.e. what do I put in place of howdoiprintarray?
View 2 Replies
View Related
Sep 8, 2010
I have madfuload installed and ubuntu (lynx normal not studio) recognizes it.I can even select keyrig under midi devices, but when I press any of the keys nothing is registered. no notes or sounds.I'm using alsa since lmms works better with that then jackmy input/output setting in lmms is alsa-sequencerlsusb:Bus 002 Device 006: ID 0763:019b Midiman KeyRig 49
cat /proc/asound/cards:
0 [Intel ]: HDA-Intel - HDA Intel
HDA Intel at 0xfebfc000 irq 16
[code]....
View 1 Replies
View Related
Jan 20, 2010
I'm trying to build my own livecd using the debian live project: [URL]. At the end (/usr/lib/finish-install.d) I want the installler to change some configuration files. The custom user selected during the installation I want to put into a variable:
Code:
#!/bin/sh
User=$(getent passwd 1000 | sed -e 's/:.*//')
if [ "$User" != "user" ] ; then
in-target sed -i "s/home/user/home/$User/g" /etc/smb.conf
in-target sed -i "s/USER=user/USER=$User/g" /etc/default/sabnzbdplus
fi
The script seems to work fine because when I have a look at the configuration files the lines have been modified. However the $User was empty. Anyone of you have some knowledge about debian-live and know how to retrieve the custom user that was entered during the installation?
View 3 Replies
View Related
Nov 5, 2009
I have a section of a script that is supposed to change the filename of similar files in a directory. It works the way I need it to work, except that I would like to input the new filename each time it runs without having to edit the script.
I capture 5-6 images into ~/screenshots. They are labeled Picture 1.png, Picture 2.png, etc. I would like to be able to rename them as Lesson 1.png, Lesson 2.png, and so forth. It works if I hardcode the new NAME (Lesson) into the script, but I want to replace NAME with a variable that I can input at a prompt or pass into the script from another. I have tried setting a variable and replacing "Lesson" with $variable in line #11, but that leaves me with only the extension and no filename.
I have also tried using $1 on the command line:
Here is what I have that works:
How do I get a variable into this script?
View 2 Replies
View Related
Jan 28, 2010
I heard (although I can't find any sources for proof) that the USER environment variable may not be set in a old Unix shells (maybe even some obscure shells as well). What is the probability that it won't be set?
View 2 Replies
View Related
Apr 28, 2010
I've written a bash script that allows a user to input a directory location to find out the size of the directory. However, if the user inputs a directory and finds its size then inputs another directory then wants to quit, the script asks the user numerous times if he wants to quit!! The script won't exit until the number of times the user looks at a directory is reached! What gives?
Here's the script:
Code:
View 4 Replies
View Related
Aug 5, 2010
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).
View 5 Replies
View Related
Jun 2, 2009
I've been using python/bash to help myself automate things for a long time, however I am curious. One reason I use python more is because I don't quite know how to work with user input in Bash, such as getting it to ask for input and wait, and then placing that user input into a command.
Here's an example of a script I use from time to time for converting OGG video files into AVI.
How could I write this same script in Bash? Keep in mind I am mostly self taught, so I am by no means an expert programmer.
Code:
View 3 Replies
View Related
Oct 15, 2010
I set up some scripts n crontab and I found that the scripts are failing because cron seems not to load my user PATH variable. Is there any way to tell cron to load my PATH variable?
View 2 Replies
View Related
Jul 4, 2010
I am using LuckyBackup to back up my laptop disk to a USB disk. I would like to display to the user the message "Please mount backup disk" and have the user click "OK". LuckyBackup has a feature to allow issuing commands before it does the backup. I have been investigating scripts (I have never written one.), but do not understand how to use them to this end.
View 4 Replies
View Related
Jan 29, 2011
I'm trying to make a script to make it quicker to encode videos.
Code:
#!/bin/bash
echo "Type the path of the video file"
[code]....
View 9 Replies
View Related
Jul 15, 2010
I wanna trace user's command input history. but I dont plan to use "history", "lastcomm" becauze there is not detail of the user command history. if there is some software use to log user command to one file or database, it's suit for me.
View 1 Replies
View Related
Dec 2, 2010
I want ssh a remote server through shell script with predefines username and passwd. i dont know how to use expect command to do that.
View 4 Replies
View Related
Feb 26, 2010
in c how to read multiple lines from user input
using scanf it is not possible and using gets we can able to read one line at a time
hoe to read multiple lines at a time from user input....
View 1 Replies
View Related
Oct 26, 2010
I ve a script to delete a folder is given below:
1. I need a script to clear the cacheroot in my box.
2. What user mention to delete the folder that should ve to delete.
View 5 Replies
View Related
Oct 27, 2010
If I have an array which its size is based on the user input, from some material, I need to use malloc function to allocate memory for that array what is known dynamic array. Don't forget to free it.hat's fine, however, I like to try things out even I know the program will crash.I have written some test program on my Mac using C language like this:int width = 0;//get user input, and assign the input value to width, for example, 3char * array_var[width];and width is an int, its value will be assigned by the user input. The point is, this program work as expected, for example, in command line, I input 3, then array_var length is 3, its size is 3 * sizeof(char *).
View 1 Replies
View Related
Aug 9, 2009
I have a script im having some problems with, what I need is to have the system generate a random password for me and use that password when creating new users to it.
System is Debian Lenny and script is in bash.
The program is znc. I have made it so that it will generate the random password on the shell but the problem is to use it in the bnc software.
To make a password there the command is znc --makepass and look like this:
My question is now if it would be possible to put in the script so it would "answer" when it need those passwords ? the random password that is generated is in a variable called $setpass and is NOT crypted.
Or is there any other software that would be able to generate that md5 string for me ?
View 7 Replies
View Related
Dec 18, 2009
openSuse v11.1
Linux 2.6.27.39-0.2-default x86_64
VirtualBox v3.1.0
One user account completely ignores all keyboard input. No other account demonstrates this bizarre behavior. The faulty account has had occasional keyboard difficulty but it has always been related to the Virtual Machines (VirtualBox); the hosting account always functioned correctly.
Then the ban on keyboard input. Poof! "Keyboard? What keyboard? I don't see no stinking keyboard!"
It is not the physical keyboard. Three different hardware exhibit the same fault. It is not the motherboard; two mb's show the same fault. It is only that one account. And I even took the Windows route of re-installing the OS (what a waste of time that was).
If something changed, I am not aware of it (although something must have).
View 9 Replies
View Related
Sep 28, 2009
I have a file called a.sql which I need to execute in a database and the script I am calling in a shell script .Before executing the script I have to change a value in the script according to the user input.How can I do this .
Eg...
A.sql file contains an sql query like this:
And My shll script is like this:
When executed the script it asks for enter salary and if the user has input 5000 then the Enter_salary value in a.sql must be replaced by 5000.
View 6 Replies
View Related
Oct 30, 2010
How do you catch user input while the script is running? Or, how would you make two scripts run at the same time, but use input from one script to the other? The program I'm trying to make, echos text on the screen continuously, but while thats happening, I want the user to be able to input something, so the program can detect the input and display something else. So I thought maybe I could make two scripts run to do each task.
View 5 Replies
View Related
Mar 10, 2011
How do i take a single line of input from the user in a shell script?
View 3 Replies
View Related
Oct 12, 2009
I am using apache2 with subversion and trying to get post commit script to run an svn update command. All svn commands seem to work fine manually
Everything used to work fine but then the server ip changed and I can no longer access it with the web name and have to use the ip directly
I am using tortoise svn with vista on my work machine
Here is the script
#!/bin/sh
export LC_CTYPE=en_US.UTF-8
/usr/bin/svn update /home/common/webroot/bob
Here is the result.
Command: Commit
Modified: C:UsersMattDesktopcheckout - bobindex.php
Sending content: C:UsersMattDesktopcheckout - bobindex.php
Completed: At revision: 63
Error: post-commit hook failed (exit code 1) with output:
code....
I think what i need to do is update the certifcate for the apache2, but I'm not sure how to do this, where to put it, and then which of the thousand apache config lines needs to be changed
View 5 Replies
View Related