• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Konsole

Konsole::ShellCommand

Konsole::ShellCommand Class Reference

A class to parse and extract information about shell commands. More...

#include <ShellCommand.h>

List of all members.


Public Member Functions

QStringList arguments () const
QString command () const
QString fullCommand () const
bool isAvailable () const
bool isRootCommand () const
 ShellCommand (const QString &command, const QStringList &arguments)
 ShellCommand (const QString &fullCommand)

Static Public Member Functions

static QStringList expand (const QStringList &items)
static QString expand (const QString &text)

Detailed Description

A class to parse and extract information about shell commands.

ShellCommand can be used to:

  • Take a command-line (eg "/bin/sh -c /path/to/my/script") and split it into its component parts (eg. the command "/bin/sh" and the arguments "-c","/path/to/my/script")
  • Take a command and a list of arguments and combine them to form a complete command line.
  • Determine whether the binary specified by a command exists in the user's PATH.
  • Determine whether a command-line specifies the execution of another command as the root user using su/sudo etc.

Definition at line 50 of file ShellCommand.h.


Constructor & Destructor Documentation

ShellCommand::ShellCommand ( const QString &  fullCommand  ) 

Constructs a ShellCommand from a command line.

Parameters:
fullCommand The command line to parse.

Definition at line 32 of file ShellCommand.cpp.

ShellCommand::ShellCommand ( const QString &  command,
const QStringList &  arguments 
)

Constructs a ShellCommand with the specified command and arguments.

Definition at line 60 of file ShellCommand.cpp.


Member Function Documentation

QStringList ShellCommand::arguments (  )  const

Returns the arguments.

Definition at line 89 of file ShellCommand.cpp.

QString ShellCommand::command (  )  const

Returns the command.

Definition at line 82 of file ShellCommand.cpp.

QStringList ShellCommand::expand ( const QStringList &  items  )  [static]

Expands environment variables in each string in list.

Definition at line 103 of file ShellCommand.cpp.

QString ShellCommand::expand ( const QString &  text  )  [static]

Expands environment variables in text .

Definition at line 112 of file ShellCommand.cpp.

QString ShellCommand::fullCommand (  )  const

Returns the full command line.

Definition at line 67 of file ShellCommand.cpp.

bool ShellCommand::isAvailable (  )  const

Returns true if the program specified by command() exists.

Definition at line 98 of file ShellCommand.cpp.

bool ShellCommand::isRootCommand (  )  const

Returns true if this is a root command.

Definition at line 93 of file ShellCommand.cpp.


The documentation for this class was generated from the following files:
  • ShellCommand.h
  • ShellCommand.cpp

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal