Search Results

Search: Posts Made By: itech4814
1,357
Posted By itech4814
Worked perfectly. Thanks.
Worked perfectly. Thanks.
1,357
Posted By itech4814
Word check within file
I am trying to see if a word exists within the file, then do command accordingly.

cmd=$(grep -ci "$word" $file)

if [ "$cmd" != "0" ]; then
echo "Word exists"
else
echo...
8,905
Posted By itech4814
It says -qF is not an option for the grep command
It says -qF is not an option for the grep command
8,905
Posted By itech4814
Statement to find if an entry exists in a file
I need to check if an entry input by the user is in a file. If so, I need to run a command, and if it does not exist then it should output entry does not exist.

So I have so far...

echo...
1,120
Posted By itech4814
It says there is no -q option for the grep...
It says there is no -q option for the grep command. I am using bash shell if that matters. Is there some kind of if statement I can use for checking the file for the entry??
1,120
Posted By itech4814
Help with deleting lines and saving them
I have a directory question where I ask the user which entry he wants to delete...

echo "Which entry?"
read entry
sed '/^'$entry'/d' file

This code does in fact delete that particular...
3,400
Posted By itech4814
Delete a line containing a string from user input
I have code that accepts input from a user, and when the user hits enter it is supposed to delete that whole line from the file.

echo "Which record? "
read record
sed '/$record/d' file
...
2,797
Posted By itech4814
So I type your code in word for word, and it...
So I type your code in word for word, and it gives me an error...

syntax error: `screen_width=$' unexpected
2,797
Posted By itech4814
bash shell
bash shell
2,797
Posted By itech4814
I just have vi editor running.... ----------...
I just have vi editor running....

---------- Post updated at 05:58 PM ---------- Previous update was at 12:09 PM ----------

gary...

when I run your script, it says `(' unexpected

Am I...
985
Posted By itech4814
There are several different lines. Each line has...
There are several different lines. Each line has a name, an address, and a phone number. The user is asked which entry they want to adjust. They are to enter the name. Once the name is entered they...
985
Posted By itech4814
Alter a part of a line specified by user
How can I adjust a specific field in a line that the user specifies...

In other words,
I have a file that contains several lines containing several fields separated by a comma.
...
1,756
Posted By itech4814
codecode
codecode
1,756
Posted By itech4814
ok that worked. The purpose of my code is to...
ok that worked. The purpose of my code is to repeat that menu until the user presses x or X. Now it is an infinite loop. I cannot figure out how to make it exit when the user presses X.
1,756
Posted By itech4814
answer=x while [ $answer != X && $answer != x ]...
answer=x
while [ $answer != X && $answer != x ]
do
echo "Phone Book"
echo "Phone Company"
echo "Company Number"
echo ""
echo ""
echo "A - Add a new line in the phone book"
echo "D - Delete a...
1,756
Posted By itech4814
Even with substituting the || for &&, it gives me...
Even with substituting the || for &&, it gives me the same error message

test: ] missing
1,756
Posted By itech4814
While Loop Errors
I have the following chunk of code...

while [ $answer != X || $answer != x ]

when I try to execute this script, it outputs an error "test: ] missing"

Is there a syntax error here?
2,797
Posted By itech4814
I'm using bash. Sorry. All I want to know is if...
I'm using bash. Sorry. All I want to know is if there is some generic command in vi editor to center a line???
2,797
Posted By itech4814
Bsh is my shell that I am using. I have a script...
Bsh is my shell that I am using. I have a script that echoes 3 lines that I stated above. I researched how to center lines in unix and someone said tO use the .ce 3 command but it didn't wOrk. Is...
2,797
Posted By itech4814
I have a menu with three separate lines... ...
I have a menu with three separate lines...

Phone Book
Company
Phone Number

I just want to center these three lines. I am in bsh. I do not know how to center these...
2,797
Posted By itech4814
Centering a line
So I am trying to use the .ce 3 command to center 3 lines in my text, but I am getting an execute permission denied. I made rwx capabilites for all users too. Any idea why I am getting this error?
7,560
Posted By itech4814
I want to read four number on one single line...
I want to read four number on one single line input by the user. Then I want to calculate the maximum number based on those four numbers.
7,560
Posted By itech4814
This is what I have.. echo "Please enter...
This is what I have..

echo "Please enter four numbers: \c"
read max
for i in 1 2 3
do
read number
[ $number -gt $max ] && max=$number
done
echo "The maximum is: $max"

How would I embed...
7,560
Posted By itech4814
It is actually a project for work. I am using it...
It is actually a project for work. I am using it to find a data file with the highest values, so I altered it here a little to just find the maximum number. How can I adjust it to read each number...
7,560
Posted By itech4814
Here's what I have.... echo "Please enter...
Here's what I have....


echo "Please enter four numbers: \c"
read max
for i in 1 2 3 4
do
read number
[ $number -gt $max ] && max=$number
done
echo "The maximum is: $max"


When I run...
Showing results 1 to 25 of 34

 
All times are GMT -4. The time now is 04:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy