Sponsored Content
Top Forums Shell Programming and Scripting Checking whether the entered text is file or not Post 302777445 by Rashid Khan on Friday 8th of March 2013 02:00:37 AM
Old 03-08-2013
Checking whether the entered text is file or not

how to check that the "file path" entered by the user has the valid file.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Repeat last entered command ?

Hi, how to do that ? I mean only print it but not execute. I'm using putty to interact with ksh. (in windows cmd up arrow does the job) thanks vilius (5 Replies)
Discussion started by: vilius
5 Replies

2. Shell Programming and Scripting

checking text file

Hello, I have the following report (report.txt) file (see attached). I would like to check the file and if the field is error, then showing error message at output. 1. In the report, 1st, 2st and 3nd line can be ignore to check 2. start to check line 4 (each field use "," to split - 1st... (1 Reply)
Discussion started by: happyv
1 Replies

3. UNIX for Dummies Questions & Answers

checking directory size in the text file

Hi All, I am new to unix scripting, please help me in completing this exercise, I have a scenario as follows, 1. i have a text file(snapshot.txt) consisting of directory names, and file size separated by comma as shown below: snapshot.txt data: ... (1 Reply)
Discussion started by: G.K.K
1 Replies

4. Shell Programming and Scripting

How to replace text in a file with text entered

I am trying to write a shell script that will allow the typing of a value, then using that value to replace data in a text file. I suspect I need sed. The format of the file is: Variable1:Value1 Variable2:Value2 The interaction would be something like: Shell Prompt: "Please enter the... (9 Replies)
Discussion started by: cleanden
9 Replies

5. Solaris

Question marks appearing instead of text entered

I have a netscape 4.79 browser for our GUI which connects to a Solaris5.8 box. During peek hours, we see question marks appearing in the screen instead of the text we enter. This results in query failure. This problem does not happen always, and is quite irritating because, we have to close the... (6 Replies)
Discussion started by: vanz
6 Replies

6. Shell Programming and Scripting

only a number can be entered no letters?

ok the user can only enter a number if a letter is entered it shouldnt be accepted This is what i have so far read -p "How many cars to enter:" cars until do read -p "Invalid number. Please re-enter:" $tags done (5 Replies)
Discussion started by: gangsta
5 Replies

7. Shell Programming and Scripting

How to accept command line argument as character or text if number is entered?

Hello Does the unix korn shell provide a function to convert number entered in command line argument to text or Character so that in next step i will convert Chr to Hex (6 Replies)
Discussion started by: aadityapatel198
6 Replies

8. Shell Programming and Scripting

How to check user entered correct file format or not?

Hi Experts, path=/db/files/ format=$1 User can enter any file format.compare the user file format with actual file format existed in the directory /db/files. User enter all characters as "A" apart from date format. example1: user will be entering the file format AAA_AA_YYYYMMDD.AAA Actual... (6 Replies)
Discussion started by: nalu
6 Replies

9. Shell Programming and Scripting

Checking and replacing first line in text file, one-liner?

Hello, I'm looking to check only the first line of a file to see if it is a format string, like # -*- coding: utf-8; mode: tcl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -\*- vim:fenc=utf-8:ft=tcl:et:sw=2:ts=2:sts=2if the first line is anything else, insert the above string. I'd... (3 Replies)
Discussion started by: f77hack
3 Replies

10. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
zipios::FilePath(3)					     Library Functions Manual					       zipios::FilePath(3)

NAME
zipios::FilePath - FilePath represents a path to a file or directory name. SYNOPSIS
#include <filepath.h> Public Member Functions FilePath (const string &path='', bool check_exists=false) Constructor. FilePath & operator= (const string &rhs) operator string () const FilePath operator+ (const FilePath &name) const Concatenates FilePath objects. FilePath filename () const Returns filename of the FilePath object by pruning the path off. bool exists () const bool isRegular () const bool isDirectory () const bool isCharSpecial () const bool isBlockSpecial () const bool isSocket () const bool isFifo () const Protected Member Functions void pruneTrailingSeparator () Prunes the trailing separator of a specified path. void check () const This function sets _checked to true, stats the path, to see if it exists and to determine what type of file it is. Protected Attributes bool _checked bool _exists bool _is_reg bool _is_dir bool _is_char bool _is_block bool _is_socket bool _is_fifo string _path Static Protected Attributes static const char _separator = '/' Detailed Description FilePath represents a path to a file or directory name. FilePath has member functions to check if the file path is a valid file system entity, and to check what kind of file system entity it is, e.g. is it a file, a directory, a pipe etc. Definition at line 18 of file filepath.h. Constructor &; Destructor Documentation zipios::FilePath::FilePath (const string &path = '', boolcheck_exists = false) Constructor. Parameters: path A string representation of the path. check_exists If true is specified the constructor will check the existence and type of the path immidiately, instead of deferring that task until it is needed. Definition at line 18 of file filepath.cpp. Member Function Documentation void zipios::FilePath::check () const [protected] This function sets _checked to true, stats the path, to see if it exists and to determine what type of file it is. All the query functions check if _checked is true, and if it isn't they call check(). This means stat'ing is deferred until it becomes necessary. Definition at line 27 of file filepath.cpp. bool zipios::FilePath::exists () const [inline] Returns: true If the path is a valid file system entity. Definition at line 129 of file filepath.h. FilePath zipios::FilePath::filename () const [inline] Returns filename of the FilePath object by pruning the path off. Definition at line 119 of file filepath.h. bool zipios::FilePath::isBlockSpecial () const [inline] Returns: true if the path is block special (a block device file). Definition at line 157 of file filepath.h. bool zipios::FilePath::isCharSpecial () const [inline] Returns: true if the path is character special (a character device file). Definition at line 150 of file filepath.h. bool zipios::FilePath::isDirectory () const [inline] Returns: true if the path is a directory. Definition at line 143 of file filepath.h. bool zipios::FilePath::isFifo () const [inline] Returns: true if the path is a Fifo (a pipe). Definition at line 171 of file filepath.h. bool zipios::FilePath::isRegular () const [inline] Returns: true if the path is a regular file. Definition at line 136 of file filepath.h. bool zipios::FilePath::isSocket () const [inline] Returns: true if the path is a socket. Definition at line 164 of file filepath.h. FilePath zipios::FilePath::operator+ (const FilePath &name) const [inline] Concatenates FilePath objects. A file separator is inserted if appropriate. Definition at line 111 of file filepath.h. void zipios::FilePath::pruneTrailingSeparator () [inline, protected] Prunes the trailing separator of a specified path. Definition at line 100 of file filepath.h. Author Generated automatically by Doxygen for Zipios++ from the source code. Zipios++ Mon Oct 10 2011 zipios::FilePath(3)
All times are GMT -4. The time now is 08:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy